mirror of
https://github.com/stablyai/orca.git
synced 2026-10-19 08:03:13 +00:00
A busy PTY delivers up to ~200 terminal frames/s to the phone (the desktop coalesces output at a 5ms window), and each frame paid a full RN-bridge + WebView postMessage + WebKit IPC + xterm write + paint pipeline. Coalesce stream writes in the RN layer: leading-edge immediate delivery keeps keystroke echo instant, and sustained streams batch into at most ~21 WebView messages/s (48ms trailing window). Measured (iOS Simulator A/B at ~200 lines/s, only this file flipped): terminal WebContent CPU 8.0% -> 2.8%, app process 19.3% -> 15.2%, combined continuous CPU -34%. Ordering boundaries preserve today's semantics: resize/reflow flush pending bytes first; init/clear drop superseded pre-snapshot bytes; reload/content-process-termination/unmount clear the buffer. The notification-dispatch extraction from TerminalWebView is a verbatim move forced by the max-lines cap.