Neil and Orca
8fd517963a
perf(terminal): measure stream byte length natively above a code-unit floor
...
The terminal RPC path counted UTF-8 bytes with a hand-rolled per-code-point scan
that Buffer.byteLength does natively an order of magnitude faster.
Routed through a small module rather than swapping the shared clipboard helper,
which has ~50 renderer call sites and a partial-count contract on the over-limit
path that must not change.
4.4x on an 8KiB batcher push, 4.2x on a 2MiB snapshot scan, 4.0x on the 48KiB
chunk gate, and 1.26-1.33x on the adversarial early-trip shapes where the legacy
scan bails after a third of the string.
The floor is load-bearing, not defensive. Buffer.byteLength has a fixed ~14ns
call cost against a scan iteration of ~1.5ns, so below the measured 8-12 code
unit crossover the native call is a REGRESSION -- 4.2x slower at one code unit,
which is keystroke echo, the most latency-sensitive PTY shape there is. Short
inputs keep the scan verbatim; 16 leaves margin over the crossover so the worst
sub-floor shape stays at parity.
measureTerminalStreamByteLength takes the native count only when
`length * 3 <= stopAfterBytes` proves the limit cannot trip, so the callers'
truncated running total is never replaced by a full count.
Co-authored-by: Orca <help@stably.ai >
2026-07-27 17:11:24 -07:00
..
2026-07-27 15:41:23 -07:00
2026-07-26 22:39:32 -07:00
2026-07-23 18:35:31 -07:00
2026-07-27 15:41:23 -07:00
2026-07-23 18:35:31 -07:00
2026-07-23 18:35:31 -07:00
2026-07-23 18:35:31 -07:00
2026-07-23 18:35:31 -07:00
2026-07-27 16:40:29 -07:00
2026-07-22 11:42:34 -07:00
2026-07-24 00:25:35 -07:00
2026-07-27 12:06:23 -07:00
2026-07-23 18:35:31 -07:00
2026-07-27 15:41:23 -07:00
2026-07-27 01:14:33 -07:00
2026-07-23 18:35:31 -07:00
2026-07-27 12:06:23 -07:00
2026-07-13 00:26:22 -07:00
2026-07-23 18:35:31 -07:00
2026-07-13 00:26:22 -07:00
2026-07-26 14:18:21 -07:00
2026-07-27 15:41:23 -07:00
2026-07-26 15:05:39 -07:00
2026-07-23 18:35:31 -07:00
2026-07-23 18:35:31 -07:00
2026-05-16 14:36:46 -07:00
2026-07-13 00:26:22 -07:00
2026-07-23 18:35:31 -07:00
2026-07-20 03:18:28 -07:00
2026-07-23 18:35:31 -07:00
2026-07-26 20:31:52 -07:00
2026-07-23 18:35:31 -07:00
2026-07-25 23:34:17 -07:00
2026-07-24 12:53:18 -07:00
2026-07-27 15:41:23 -07:00
2026-07-10 00:11:27 -07:00
2026-07-23 18:35:31 -07:00
2026-07-27 01:14:33 -07:00
2026-07-27 15:55:31 -07:00
2026-07-27 15:34:20 -07:00
2026-07-27 01:14:33 -07:00
2026-07-23 18:35:31 -07:00
2026-07-23 18:35:31 -07:00
2026-07-26 20:31:58 -07:00
2026-07-27 16:36:39 -07:00
2026-07-26 19:46:29 -07:00
2026-07-27 16:36:39 -07:00
2026-07-23 18:35:31 -07:00
2026-07-23 18:35:31 -07:00
2026-07-27 12:31:37 -07:00
2026-07-23 18:35:31 -07:00
2026-07-23 18:35:31 -07:00
2026-05-30 02:46:28 -07:00
2026-07-23 18:35:31 -07:00
2026-07-27 12:21:14 -07:00
2026-07-23 18:35:31 -07:00
2026-07-23 19:05:22 -07:00
2026-07-27 01:14:33 -07:00
2026-07-23 18:35:31 -07:00
2026-07-23 18:35:31 -07:00
2026-07-27 15:55:31 -07:00
2026-07-25 02:30:59 -07:00
2026-07-26 15:52:03 -07:00
2026-07-27 17:11:24 -07:00
2026-07-21 18:23:20 -07:00
2026-07-24 15:53:22 -07:00
2026-07-23 18:35:31 -07:00
2026-07-26 13:14:57 -07:00
2026-05-30 13:26:48 -07:00
2026-07-27 12:31:37 -07:00
2026-06-29 22:38:29 -07:00
2026-07-26 15:24:26 -07:00
2026-07-23 18:35:31 -07:00
2026-07-20 03:18:24 -07:00
2026-07-25 19:31:44 -07:00
2026-07-24 19:54:25 -07:00
2026-07-23 18:35:31 -07:00
2026-07-27 01:14:33 -07:00
2026-07-20 01:14:17 -07:00
2026-07-23 18:35:31 -07:00
2026-07-23 18:35:31 -07:00
2026-06-17 16:20:37 -07:00
2026-06-17 16:20:37 -07:00
2026-05-18 14:09:21 -07:00
2026-05-18 14:09:21 -07:00
2026-05-18 14:09:21 -07:00
2026-07-23 06:22:56 -07:00
2026-07-23 06:22:56 -07:00
2026-07-23 18:35:31 -07:00
2026-07-23 18:35:31 -07:00
2026-06-22 18:01:37 -07:00
2026-06-22 18:01:37 -07:00
2026-07-17 15:27:39 -07:00
2026-07-17 15:27:39 -07:00
2026-07-24 19:54:25 -07:00
2026-07-24 19:54:25 -07:00
2026-07-26 00:13:48 -07:00
2026-07-26 00:13:48 -07:00
2026-07-26 00:13:48 -07:00
2026-04-19 12:09:32 -07:00
2026-05-15 23:52:37 -07:00
2026-06-30 11:31:55 -07:00
2026-06-30 11:31:55 -07:00
2026-07-27 01:14:33 -07:00
2026-07-27 01:14:33 -07:00
2026-06-30 11:31:55 -07:00
2026-07-22 17:17:59 -07:00
2026-07-22 17:17:59 -07:00
2026-05-30 15:26:11 -04:00
2026-06-29 22:38:29 -07:00
2026-07-16 23:10:40 -07:00
2026-06-19 17:14:55 -07:00
2026-06-29 22:38:29 -07:00
2026-07-23 18:35:31 -07:00
2026-07-23 18:35:31 -07:00
2026-07-27 12:31:37 -07:00
2026-07-23 18:35:31 -07:00
2026-05-30 09:04:52 -07:00
2026-05-30 09:04:52 -07:00
2026-07-18 23:01:29 -07:00
2026-07-23 18:35:31 -07:00
2026-07-23 18:35:31 -07:00
2026-07-13 01:10:38 -07:00
2026-07-23 18:35:31 -07:00
2026-07-23 18:35:31 -07:00
2026-07-10 17:52:50 -07:00
2026-07-15 15:23:35 -07:00
2026-07-15 15:23:35 -07:00
2026-07-06 16:43:05 -07:00
2026-07-06 16:43:05 -07:00
2026-05-30 09:04:52 -07:00
2026-05-30 09:04:52 -07:00
2026-07-27 01:14:33 -07:00
2026-07-20 19:47:58 -07:00
2026-07-26 01:39:49 -07:00
2026-07-27 01:14:33 -07:00
2026-06-24 00:17:49 -07:00
2026-06-24 00:17:49 -07:00
2026-06-17 16:08:14 -07:00
2026-07-13 01:10:38 -07:00
2026-07-25 22:28:07 -07:00
2026-07-25 22:28:07 -07:00
2026-06-24 21:07:15 -04:00
2026-06-29 22:38:29 -07:00
2026-07-23 18:03:43 -07:00
2026-07-23 18:03:43 -07:00
2026-07-23 18:35:31 -07:00
2026-07-23 18:35:31 -07:00
2026-07-25 04:04:19 -07:00
2026-07-25 04:04:19 -07:00
2026-07-25 04:04:19 -07:00
2026-07-25 04:04:19 -07:00
2026-07-23 18:35:31 -07:00
2026-07-23 18:35:31 -07:00
2026-07-26 02:32:05 -07:00
2026-07-26 02:32:05 -07:00
2026-07-26 02:32:05 -07:00
2026-07-26 02:32:05 -07:00
2026-06-29 22:38:29 -07:00
2026-07-09 16:24:20 -07:00
2026-07-09 16:24:20 -07:00
2026-07-20 14:34:53 -07:00
2026-07-23 18:35:31 -07:00
2026-07-23 18:35:31 -07:00
2026-06-21 18:51:44 -07:00
2026-07-14 01:55:04 -07:00
2026-07-10 17:27:47 -07:00
2026-07-10 17:27:47 -07:00
2026-05-21 21:52:26 -07:00
2026-05-21 21:52:26 -07:00
2026-05-21 21:52:26 -07:00
2026-05-21 21:52:26 -07:00
2026-07-06 20:21:58 -07:00
2026-07-06 20:21:58 -07:00
2026-07-25 03:11:59 -07:00
2026-07-25 03:11:59 -07:00
2026-07-23 18:35:31 -07:00
2026-07-23 18:35:31 -07:00
2026-07-09 02:13:13 -07:00
2026-07-11 21:03:04 -07:00
2026-07-11 21:03:04 -07:00
2026-07-23 18:35:31 -07:00
2026-07-23 18:35:31 -07:00
2026-07-27 16:36:39 -07:00
2026-07-27 16:36:39 -07:00
2026-07-17 15:27:39 -07:00
2026-07-17 15:27:39 -07:00
2026-07-09 23:00:01 -07:00
2026-05-30 13:09:17 -07:00
2026-07-23 18:35:31 -07:00
2026-05-27 00:47:01 -07:00
2026-07-05 02:53:17 -07:00
2026-07-23 18:35:31 -07:00
2026-07-06 15:12:56 -07:00
2026-05-26 20:56:11 -07:00
2026-07-22 18:52:37 -07:00
2026-07-09 23:00:01 -07:00
2026-07-27 16:36:39 -07:00
2026-07-27 16:36:39 -07:00
2026-05-31 10:11:51 -07:00
2026-05-31 10:11:51 -07:00
2026-05-06 23:30:03 -07:00
2026-06-29 22:38:29 -07:00
2026-07-11 02:03:14 -07:00
2026-07-09 22:37:40 -04:00
2026-07-11 02:03:14 -07:00
2026-07-24 00:27:40 -07:00
2026-07-24 00:27:40 -07:00
2026-07-25 22:28:07 -07:00
2026-07-25 22:28:07 -07:00
2026-05-30 11:01:09 -07:00
2026-07-23 19:00:00 -07:00
2026-07-23 19:00:00 -07:00
2026-07-11 02:05:58 -07:00
2026-07-04 21:31:51 -07:00
2026-07-04 21:31:51 -07:00
2026-06-29 18:02:10 -07:00
2026-06-03 12:25:54 -07:00
2026-06-03 12:25:54 -07:00
2026-07-23 18:35:31 -07:00
2026-07-02 11:24:07 -07:00
2026-07-23 18:35:31 -07:00
2026-07-26 00:41:03 -07:00
2026-07-23 18:35:31 -07:00
2026-07-23 18:35:31 -07:00
2026-05-29 16:06:33 -07:00
2026-07-19 17:31:34 -07:00
2026-07-14 15:23:06 -07:00
2026-06-29 00:32:36 -07:00
2026-06-29 22:38:29 -07:00
2026-07-12 23:19:15 -07:00
2026-07-19 16:04:05 -07:00