Commit 728aed5
committed
revert: drop PrefixSource.buffer() override that was slower than the default
Bench data (es6-promise.js fixture, 10 calls per task body):
Source.buffer() default: ~1143 ops/s
Hand-written single-pass buffer(): ~960 ops/s
V8's optimized string replace + Buffer.from utf8 encode beats a
JS-side indexOf+copy loop on typical ASCII inputs. The earlier commit
shipped a slower buffer() in exchange for halved transient memory,
but the CPU regression isn't worth that trade-off — and Source.buffer()
already routes through this.source(), so subclasses that want the
prefixed bytes don't lose anything.
buffers() keeps the zero-copy splice implementation (~57% faster than
the default [this.buffer()] path), which is the genuine win from
addressing the TODO.
https://claude.ai/code/session_01EHhGq9PRFRGefVtwwasCqZ1 parent 81fe063 commit 728aed5
1 file changed
Lines changed: 8 additions & 42 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
62 | 62 | | |
63 | 63 | | |
64 | 64 | | |
65 | | - | |
66 | | - | |
67 | | - | |
68 | | - | |
69 | | - | |
70 | | - | |
71 | | - | |
72 | | - | |
73 | | - | |
74 | | - | |
75 | | - | |
76 | | - | |
77 | | - | |
78 | | - | |
79 | | - | |
80 | | - | |
81 | | - | |
82 | | - | |
83 | | - | |
84 | | - | |
85 | | - | |
86 | | - | |
87 | | - | |
88 | | - | |
89 | | - | |
90 | | - | |
91 | | - | |
92 | | - | |
93 | | - | |
94 | | - | |
95 | | - | |
96 | | - | |
97 | | - | |
98 | | - | |
99 | | - | |
100 | | - | |
101 | | - | |
102 | | - | |
103 | | - | |
104 | | - | |
105 | | - | |
106 | 65 | | |
107 | 66 | | |
108 | 67 | | |
109 | | - | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
110 | 76 | | |
111 | 77 | | |
112 | 78 | | |
| |||
0 commit comments