Commit c29e061
committed
perf(concat-source): replace for-of in buffers() with indexed loops
Per-call iterator allocation for the outer `for (const child of
this._children)` and the inner `for (const buffer of child.buffers())`
shows up as ~40% of buffers() time on a nested 4x10 ConcatSource —
the shape webpack produces during emit when wrapping module bodies.
A/B/A median over 5 alternating wall-clock runs (es6-promise.js fixture,
nested 4x10 raw):
baseline: 659 075 ops/s
this: 1 054 270 ops/s (+60%)
Same V8 hot-path principle as the recent PrefixSource regex switch —
the optimizer is much happier when array iteration stays integer-
indexed and the array element type stays monomorphic. Index-based
length hoisting (`childCount`, `blen`) keeps the bound check out of
the loop body.
Tests unchanged; full suite still green.
https://claude.ai/code/session_01EHhGq9PRFRGefVtwwasCqZ1 parent dac0eb8 commit c29e061
1 file changed
Lines changed: 10 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
97 | 97 | | |
98 | 98 | | |
99 | 99 | | |
| 100 | + | |
| 101 | + | |
100 | 102 | | |
101 | 103 | | |
102 | | - | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
103 | 109 | | |
104 | | - | |
105 | | - | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
106 | 113 | | |
107 | 114 | | |
108 | 115 | | |
| |||
0 commit comments