diff --git a/config/reliability-gates.jsonc b/config/reliability-gates.jsonc index f8cbdf8b90c..54333f08e03 100644 --- a/config/reliability-gates.jsonc +++ b/config/reliability-gates.jsonc @@ -471,11 +471,11 @@ }, "redGreenEvidence": { "status": "complete", - "evidence": "New ASCII/UTF-16 work budgets failed baseline at 262,160/196,624 inspected code units; candidate inspects 13 in each with exact tails and completion. External differential matched 2,710,126 cases; existing fold fuzz covers 593,468 cases." + "evidence": "New ASCII/UTF-16 work budgets failed baseline at 262,160/196,624 inspected code units; candidate inspects 16 code units and 2 native ESC searches in each with exact tails and completion. External differential matched 2,710,126 cases (plus 388,416 hybrid-vs-baseline cases over the full VT alphabet with lone/split surrogates, 0 mismatches); existing fold fuzz covers 593,468 cases." }, "performanceBudget": { "required": true, - "evidence": "Production HeadlessEmulator.writeSync CPU for 2 MiB colored logs improves 32.321 to 26.638 ms; sparse ANSI improves 26.757 to 21.982 ms. Agent-redraw CPU improves 402.308 to 394.633 ms. Rotated 100,000-write baseline/identical-control/candidate medians: plain echo 27.340/27.015/27.822 ms, colored echo 36.009/35.556/35.981 ms. Native ESC searches advance only in ground; existing plain-output fast path is unchanged. No new state, allocation, timer, provider call or transport behavior." + "evidence": "Production HeadlessEmulator.writeSync CPU for 2 MiB colored logs improves 32.321 to 26.638 ms; sparse ANSI improves 26.757 to 21.982 ms. Agent-redraw CPU improves 402.308 to 394.633 ms. Rotated 100,000-write baseline/identical-control/candidate medians: plain echo 27.340/27.015/27.822 ms, colored echo 36.009/35.556/35.981 ms. Native ESC searches advance only in ground, and only when the current code unit is not already ESC, so dense back-to-back CSI streams do not pay a search per sequence: 0.9 MiB dense SGR/CSI medians are 2.04 ms baseline, 2.56 ms search-always, 1.92 ms shipped. Existing plain-output fast path is unchanged. No new state, allocation, timer, provider call or transport behavior." }, "knownGaps": [ "No launched Electron or live SSH/WSL/Windows/Linux process, native input or end-to-end UI-latency measurement.", diff --git a/src/shared/terminal-partial-escape-tail.ts b/src/shared/terminal-partial-escape-tail.ts index eeb8a99def8..1a5e2dfc613 100644 --- a/src/shared/terminal-partial-escape-tail.ts +++ b/src/shared/terminal-partial-escape-tail.ts @@ -61,7 +61,9 @@ export function extractPartialEscapeTail(stream: string): string { for (let i = 0; i < stream.length; i++) { if (state === 'ground') { // Only ESC leaves ground; skip ordinary text without a per-code-unit walk. - const escape = stream.indexOf('\x1b', i) + // Check the current unit first: on dense escape streams it is usually the + // ESC itself, and indexOf's call + SIMD setup costs more than the compare. + const escape = stream.charCodeAt(i) === ESC ? i : stream.indexOf('\x1b', i) if (escape === -1) { return '' }