You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
perf(prefix-source): use V8 fast-path regex (no lookahead) in source()
The /\n(?=.|\s)/g lookahead form disables V8's literal-character regex
fast-path. Switching to /\n/g + a tail-strip when the input ends with
a newline produces identical output and lets V8 take the fast path —
faster CPU and lower instruction count.
Hoists the prefixed-string builder into a `buildPrefixed(prefix, node)`
helper used by both source() and streamChunks(), so the two callsites
stay in sync.
Drops the buffers() override that landed earlier in this branch:
- source() got faster, so the inherited Source.buffer() (which goes
through this.source() + Buffer.from) automatically gets faster too;
- the inherited Source.buffers() = [this.buffer()] therefore also
speeds up — the prior splice-based buffers() override regressed
~3.6x in CodSpeed instruction count and is replaced by the leaner
inheritance path.
Local A/B/A wall-clock (es6-promise.js fixture, 5 alternating runs):
source(): 1592 -> 1766 ops/s (+11%)
buffer(): 1149 -> 1520 ops/s (+32%)
buffers(): inherited, now ~1506 ops/s
size(): inherited, now ~1516 ops/s
Mutable-child regression test still passes (no caching introduced).
https://claude.ai/code/session_01EHhGq9PRFRGefVtwwasCqZ
0 commit comments