perf: optimize tab switching responsiveness

- Increase chunked write size from 64KB to 128KB (halves write time)
- Start buffer fetch immediately before other setup work
- Show "Loading session..." indicator during fetch
- Parallelize session attach with buffer fetch
- Fire-and-forget resize call (don't block on it)

Reduces perceived tab switch latency by ~50-100ms for large buffers.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
arkon
2026-02-02 05:08:51 +01:00
co-authored by Claude Opus 4.5
parent efd00658aa
commit b0d3dfe3a6
2 changed files with 45 additions and 31 deletions
+8 -2
View File
@@ -310,11 +310,17 @@ for (const segment of segments) {
```
Note: Segments starting with `DEC_SYNC_START` are incomplete blocks awaiting more data. These are skipped (discarded if timeout forces flush).
**chunkedTerminalWrite(buffer, chunkSize=64KB):**
**chunkedTerminalWrite(buffer, chunkSize=128KB):**
- For large buffer restoration (session switch, reconnect)
- Writes 64KB per `requestAnimationFrame` to avoid UI jank
- Writes 128KB per `requestAnimationFrame` to avoid UI jank
- Strips any embedded DEC 2026 markers from historical data
**selectSession() optimizations:**
- Starts buffer fetch immediately before other setup
- Shows "Loading session..." indicator while fetching
- Parallelizes session attach with buffer fetch
- Fire-and-forget resize (doesn't block tab switch)
### Optional Flicker Filter
Per-session toggle via Session Settings. Adds ~50ms latency but eliminates remaining flicker on problematic terminals.