Commit 22e303a
committed
perf: optimize transcription flow by reducing delays and improving UX
This commit implements several performance optimizations to reduce transcription
latency by 250ms while maintaining stability and improving user experience:
## Changes
### 1. **Reduced UI Delays (100ms → 50ms savings)**
- **audio.rs**: Reduced pill window hide delay from 100ms to 50ms
- **text.rs**: Reduced all text insertion delays from 100ms to 50ms
- App focus delay, clipboard ready delay, paste preparation delays
- **Impact**: Faster transcription completion without compromising reliability
### 2. **Simplified Clipboard Behavior (200ms savings + better UX)**
- **text.rs**: Removed clipboard restoration logic that restored original content after 200ms
- **Rationale**: Users expect transcribed text to remain in clipboard for additional pastes
- **Benefits**:
- Saves 200ms delay from restoration thread
- Prevents confusing behavior where clipboard content changes after paste
- Transcribed text stays available for multiple pastes
### 3. **Sequential Execution with Optimized Timing**
- **audio.rs**: Fixed potential race condition from initial parallel execution attempt
- **Implementation**: Hide pill window first, then reduced delay, then insert text
- **Safety**: Maintains UI stability while achieving 50% delay reduction
## Performance Impact
- **Total time saved**: ~250ms per transcription
- **Improved UX**: Cleaner clipboard behavior, no restoration confusion
- **Maintained reliability**: Sequential execution prevents UI race conditions
## Testing
- ✅ All audio tests pass (37/37)
- ✅ Code compiles without errors
- ✅ No breaking changes to existing functionality1 parent 4f583b2 commit 22e303a
2 files changed
+18
-28
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
951 | 951 | | |
952 | 952 | | |
953 | 953 | | |
954 | | - | |
955 | | - | |
| 954 | + | |
956 | 955 | | |
| 956 | + | |
| 957 | + | |
957 | 958 | | |
958 | 959 | | |
959 | 960 | | |
| |||
962 | 963 | | |
963 | 964 | | |
964 | 965 | | |
965 | | - | |
966 | | - | |
967 | | - | |
968 | | - | |
| 966 | + | |
| 967 | + | |
969 | 968 | | |
970 | | - | |
| 969 | + | |
971 | 970 | | |
972 | 971 | | |
973 | 972 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
30 | 30 | | |
31 | 31 | | |
32 | 32 | | |
33 | | - | |
| 33 | + | |
34 | 34 | | |
35 | 35 | | |
36 | 36 | | |
| |||
58 | 58 | | |
59 | 59 | | |
60 | 60 | | |
61 | | - | |
62 | | - | |
63 | | - | |
64 | | - | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
65 | 66 | | |
66 | 67 | | |
67 | 68 | | |
68 | 69 | | |
69 | 70 | | |
70 | 71 | | |
71 | 72 | | |
72 | | - | |
| 73 | + | |
73 | 74 | | |
74 | 75 | | |
75 | 76 | | |
| |||
129 | 130 | | |
130 | 131 | | |
131 | 132 | | |
132 | | - | |
133 | | - | |
134 | | - | |
135 | | - | |
136 | | - | |
137 | | - | |
138 | | - | |
139 | | - | |
140 | | - | |
141 | | - | |
142 | | - | |
143 | | - | |
| 133 | + | |
| 134 | + | |
144 | 135 | | |
145 | 136 | | |
146 | 137 | | |
| |||
245 | 236 | | |
246 | 237 | | |
247 | 238 | | |
248 | | - | |
| 239 | + | |
249 | 240 | | |
250 | 241 | | |
251 | 242 | | |
| |||
287 | 278 | | |
288 | 279 | | |
289 | 280 | | |
290 | | - | |
| 281 | + | |
291 | 282 | | |
292 | 283 | | |
293 | 284 | | |
| |||
341 | 332 | | |
342 | 333 | | |
343 | 334 | | |
344 | | - | |
| 335 | + | |
345 | 336 | | |
346 | 337 | | |
347 | 338 | | |
| |||
0 commit comments