| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
|
If the figures from #60399 still apply for ArrayBuffer-backed buffers, is there scope to add isArrayBuffer(TypedArrayPrototypeGetBuffer(target)) to the previous conditions, and get the best of both worlds? |
Sorry, something went wrong.
There was a problem hiding this comment.
lgtm
Sorry, something went wrong.
doing all of these type checks also adds overhead. Furthermore the benchmark from that PR apply to concat so it's unclear what it's actual effect on Buffer.copy is... |
Sorry, something went wrong.
Sorry, something went wrong.
Codecov Report✅ All modified and coverable lines are covered by tests. @@ Coverage Diff @@
## main #62032 +/- ##
==========================================
+ Coverage 89.65% 89.69% +0.03%
==========================================
Files 676 676
Lines 206231 206236 +5
Branches 39505 39759 +254
==========================================
+ Hits 184898 184981 +83
+ Misses 13463 13404 -59
+ Partials 7870 7851 -19
... and 28 files with indirect coverage changes 🚀 New features to boost your workflow:
|
Sorry, something went wrong.
There was a problem hiding this comment.
Think it's worth mentioning in the commit message that this is essentially a reversion of 24bebd0, sans tests.
Sorry, something went wrong.
This fixes a performance regression for Buffer.copy(target, 0) and brings it back inline with Buffer.write.
V8 has a massive TypedArray.prototype.set penalty on SharedArrayBuffer
Buffer.set and Buffer.copy are up to 8.4x slower when writing to a SharedArrayBuffer vs a regular ArrayBuffer, while Buffer.write (string encoding) is completely unaffected.
256 bytes, varying offset (Apple M3 Pro, Node 25.6.1):
ArrayBuffer SharedArrayBuffer Slowdown
Buffer.set 13.6 ns 56.1 ns 4.1x
Buffer.copy 17.0 ns 65.1 ns 3.8x
Buffer.write 75.8 ns 74.1 ns 1.0x (unaffected)
4096 bytes, varying offset:
ArrayBuffer SharedArrayBuffer Slowdown
Buffer.set 80.3 ns 674.2 ns 8.4x
Buffer.copy 78.4 ns 677.7 ns 8.6x
Buffer.write 190.6 ns 186.1 ns 1.0x (unaffected)
Failed to start CI⚠ Commits were pushed since the last approving review: ⚠ - buffer: always use _copy for copy ✘ Refusing to run CI on potentially unsafe PRhttps://github.com/nodejs/node/actions/runs/22516891493 |
Sorry, something went wrong.
There was a problem hiding this comment.
I am seeing a significant regression in non-partial copy performance:
node % ./node benchmark/buffers/buffer-copy.js
buffers/buffer-copy.js n=6000000 partial="true" bytes=8: 37,745,651.53108819
buffers/buffer-copy.js n=6000000 partial="false" bytes=8: 72,230,886.31703596
buffers/buffer-copy.js n=6000000 partial="true" bytes=128: 37,269,250.926878504
buffers/buffer-copy.js n=6000000 partial="false" bytes=128: 70,233,110.24800341
buffers/buffer-copy.js n=6000000 partial="true" bytes=1024: 26,739,253.757964805
buffers/buffer-copy.js n=6000000 partial="false" bytes=1024: 37,699,305.6259145
node % ./node-ronag benchmark/buffers/buffer-copy.js
buffers/buffer-copy.js n=6000000 partial="true" bytes=8: 36,820,630.5993248
buffers/buffer-copy.js n=6000000 partial="false" bytes=8: 37,401,995.084754474
buffers/buffer-copy.js n=6000000 partial="true" bytes=128: 37,360,956.762793645
buffers/buffer-copy.js n=6000000 partial="false" bytes=128: 35,075,651.428067446
buffers/buffer-copy.js n=6000000 partial="true" bytes=1024: 26,155,344.217952482
buffers/buffer-copy.js n=6000000 partial="false" bytes=1024: 22,480,048.984626204Those checks are necessary to hit the V8 .set optimization, it is faster than our native copy, I think we should instead make those checks more strict if you found a case that's slower, as @Renegade334 suggested
You are right that .concat no longer hits that path, but copy still does
Cc @ChALkeR
Sorry, something went wrong.
|
Benchmark CI: https://ci.nodejs.org/view/Node.js%20benchmark/job/benchmark-node-micro-benchmarks/1805/ Resultsconfidence improvement accuracy (*) (**) (***)
buffers/buffer-atob.js n=1000000 size=128 -0.49 % ±1.61% ±2.15% ±2.80%
buffers/buffer-atob.js n=1000000 size=16 -0.75 % ±1.78% ±2.37% ±3.10%
buffers/buffer-atob.js n=1000000 size=32 -0.49 % ±1.52% ±2.03% ±2.64%
buffers/buffer-atob.js n=1000000 size=64 -0.83 % ±1.81% ±2.41% ±3.14%
buffers/buffer-base64-decode-wrapped.js n=32 linesCount=524288 charsPerLine=76 -0.27 % ±0.89% ±1.18% ±1.54%
buffers/buffer-base64-decode.js size=8388608 n=32 -0.06 % ±0.17% ±0.22% ±0.29%
buffers/buffer-base64-encode.js n=32 len=67108864 -0.02 % ±0.10% ±0.13% ±0.17%
buffers/buffer-base64url-decode.js size=8388608 n=32 0.05 % ±0.17% ±0.23% ±0.30%
buffers/buffer-base64url-encode.js n=32 len=67108864 0.03 % ±0.08% ±0.10% ±0.13%
buffers/buffer-btoa.js n=1000000 size=1024 * 1.09 % ±0.85% ±1.13% ±1.48%
buffers/buffer-btoa.js n=1000000 size=128 * 1.95 % ±1.87% ±2.49% ±3.24%
buffers/buffer-btoa.js n=1000000 size=16 -1.04 % ±1.85% ±2.47% ±3.21%
buffers/buffer-btoa.js n=1000000 size=256 -0.08 % ±1.81% ±2.42% ±3.15%
buffers/buffer-btoa.js n=1000000 size=32 -0.86 % ±2.06% ±2.74% ±3.57%
buffers/buffer-btoa.js n=1000000 size=64 -0.63 % ±1.65% ±2.19% ±2.87%
buffers/buffer-bytelength-buffer.js n=4000000 len=16 -1.51 % ±3.26% ±4.33% ±5.64%
buffers/buffer-bytelength-buffer.js n=4000000 len=2 0.40 % ±3.28% ±4.37% ±5.68%
buffers/buffer-bytelength-buffer.js n=4000000 len=256 1.18 % ±2.60% ±3.46% ±4.51%
buffers/buffer-bytelength-string.js n=4000000 repeat=1 encoding='base64' type='four_bytes' 0.44 % ±2.84% ±3.78% ±4.92%
buffers/buffer-bytelength-string.js n=4000000 repeat=1 encoding='base64' type='latin1' * -3.34 % ±2.61% ±3.48% ±4.54%
buffers/buffer-bytelength-string.js n=4000000 repeat=1 encoding='base64' type='one_byte' ** -4.10 % ±2.65% ±3.54% ±4.62%
buffers/buffer-bytelength-string.js n=4000000 repeat=1 encoding='base64' type='three_bytes' 1.57 % ±1.99% ±2.64% ±3.45%
buffers/buffer-bytelength-string.js n=4000000 repeat=1 encoding='base64' type='two_bytes' 1.39 % ±2.60% ±3.46% ±4.50%
buffers/buffer-bytelength-string.js n=4000000 repeat=1 encoding='utf8' type='four_bytes' -0.77 % ±1.58% ±2.10% ±2.74%
buffers/buffer-bytelength-string.js n=4000000 repeat=1 encoding='utf8' type='latin1' 1.47 % ±2.33% ±3.10% ±4.03%
buffers/buffer-bytelength-string.js n=4000000 repeat=1 encoding='utf8' type='one_byte' 2.14 % ±2.38% ±3.17% ±4.12%
buffers/buffer-bytelength-string.js n=4000000 repeat=1 encoding='utf8' type='three_bytes' 1.42 % ±1.92% ±2.55% ±3.32%
buffers/buffer-bytelength-string.js n=4000000 repeat=1 encoding='utf8' type='two_bytes' -0.04 % ±1.83% ±2.44% ±3.18%
buffers/buffer-bytelength-string.js n=4000000 repeat=16 encoding='base64' type='four_bytes' 0.44 % ±2.50% ±3.32% ±4.33%
buffers/buffer-bytelength-string.js n=4000000 repeat=16 encoding='base64' type='latin1' 0.46 % ±2.48% ±3.31% ±4.31%
buffers/buffer-bytelength-string.js n=4000000 repeat=16 encoding='base64' type='one_byte' 1.80 % ±2.89% ±3.85% ±5.01%
buffers/buffer-bytelength-string.js n=4000000 repeat=16 encoding='base64' type='three_bytes' -1.71 % ±2.33% ±3.10% ±4.03%
buffers/buffer-bytelength-string.js n=4000000 repeat=16 encoding='base64' type='two_bytes' -0.20 % ±2.90% ±3.85% ±5.02%
buffers/buffer-bytelength-string.js n=4000000 repeat=16 encoding='utf8' type='four_bytes' 0.02 % ±0.12% ±0.16% ±0.21%
buffers/buffer-bytelength-string.js n=4000000 repeat=16 encoding='utf8' type='latin1' 0.16 % ±0.97% ±1.29% ±1.68%
buffers/buffer-bytelength-string.js n=4000000 repeat=16 encoding='utf8' type='one_byte' -0.27 % ±3.36% ±4.47% ±5.81%
buffers/buffer-bytelength-string.js n=4000000 repeat=16 encoding='utf8' type='three_bytes' -0.01 % ±0.44% ±0.59% ±0.77%
buffers/buffer-bytelength-string.js n=4000000 repeat=16 encoding='utf8' type='two_bytes' 0.11 % ±0.50% ±0.66% ±0.86%
buffers/buffer-bytelength-string.js n=4000000 repeat=2 encoding='base64' type='four_bytes' 0.71 % ±2.57% ±3.41% ±4.44%
buffers/buffer-bytelength-string.js n=4000000 repeat=2 encoding='base64' type='latin1' -0.27 % ±2.58% ±3.43% ±4.47%
buffers/buffer-bytelength-string.js n=4000000 repeat=2 encoding='base64' type='one_byte' 2.22 % ±3.02% ±4.02% ±5.23%
buffers/buffer-bytelength-string.js n=4000000 repeat=2 encoding='base64' type='three_bytes' 1.53 % ±2.43% ±3.24% ±4.22%
buffers/buffer-bytelength-string.js n=4000000 repeat=2 encoding='base64' type='two_bytes' -0.08 % ±2.79% ±3.71% ±4.83%
buffers/buffer-bytelength-string.js n=4000000 repeat=2 encoding='utf8' type='four_bytes' 0.33 % ±0.71% ±0.95% ±1.23%
buffers/buffer-bytelength-string.js n=4000000 repeat=2 encoding='utf8' type='latin1' 0.63 % ±3.06% ±4.08% ±5.31%
buffers/buffer-bytelength-string.js n=4000000 repeat=2 encoding='utf8' type='one_byte' 0.43 % ±3.83% ±5.10% ±6.63%
buffers/buffer-bytelength-string.js n=4000000 repeat=2 encoding='utf8' type='three_bytes' -0.05 % ±1.25% ±1.67% ±2.17%
buffers/buffer-bytelength-string.js n=4000000 repeat=2 encoding='utf8' type='two_bytes' -0.40 % ±1.33% ±1.76% ±2.30%
buffers/buffer-bytelength-string.js n=4000000 repeat=256 encoding='base64' type='four_bytes' 1.46 % ±2.65% ±3.53% ±4.59%
buffers/buffer-bytelength-string.js n=4000000 repeat=256 encoding='base64' type='latin1' -1.15 % ±2.40% ±3.20% ±4.16%
buffers/buffer-bytelength-string.js n=4000000 repeat=256 encoding='base64' type='one_byte' -2.75 % ±2.89% ±3.85% ±5.01%
buffers/buffer-bytelength-string.js n=4000000 repeat=256 encoding='base64' type='three_bytes' -0.47 % ±2.85% ±3.79% ±4.94%
buffers/buffer-bytelength-string.js n=4000000 repeat=256 encoding='base64' type='two_bytes' -1.25 % ±2.26% ±3.00% ±3.91%
buffers/buffer-bytelength-string.js n=4000000 repeat=256 encoding='utf8' type='four_bytes' -0.00 % ±0.00% ±0.01% ±0.01%
buffers/buffer-bytelength-string.js n=4000000 repeat=256 encoding='utf8' type='latin1' 0.10 % ±0.14% ±0.19% ±0.25%
buffers/buffer-bytelength-string.js n=4000000 repeat=256 encoding='utf8' type='one_byte' -0.55 % ±1.37% ±1.82% ±2.38%
buffers/buffer-bytelength-string.js n=4000000 repeat=256 encoding='utf8' type='three_bytes' 0.13 % ±0.19% ±0.25% ±0.33%
buffers/buffer-bytelength-string.js n=4000000 repeat=256 encoding='utf8' type='two_bytes' -0.00 % ±0.02% ±0.03% ±0.04%
buffers/buffer-compare-instance-method.js n=1000000 args=1 size=16 1.89 % ±2.48% ±3.30% ±4.30%
buffers/buffer-compare-instance-method.js n=1000000 args=1 size=16386 -2.22 % ±2.80% ±3.77% ±4.99%
buffers/buffer-compare-instance-method.js n=1000000 args=1 size=4096 -1.83 % ±2.55% ±3.41% ±4.46%
buffers/buffer-compare-instance-method.js n=1000000 args=1 size=512 -3.33 % ±3.87% ±5.16% ±6.72%
buffers/buffer-compare-instance-method.js n=1000000 args=2 size=16 -0.66 % ±2.37% ±3.15% ±4.11%
buffers/buffer-compare-instance-method.js n=1000000 args=2 size=16386 3.34 % ±3.68% ±4.90% ±6.38%
buffers/buffer-compare-instance-method.js n=1000000 args=2 size=4096 -0.91 % ±3.02% ±4.02% ±5.23%
buffers/buffer-compare-instance-method.js n=1000000 args=2 size=512 1.86 % ±2.46% ±3.27% ±4.25%
buffers/buffer-compare-instance-method.js n=1000000 args=5 size=16 -0.18 % ±3.71% ±4.93% ±6.42%
buffers/buffer-compare-instance-method.js n=1000000 args=5 size=16386 1.37 % ±4.11% ±5.47% ±7.12%
buffers/buffer-compare-instance-method.js n=1000000 args=5 size=4096 1.26 % ±2.95% ±3.92% ±5.11%
buffers/buffer-compare-instance-method.js n=1000000 args=5 size=512 0.58 % ±3.25% ±4.32% ±5.62%
buffers/buffer-compare-offset.js n=1000000 size=16 method='offset' -0.21 % ±1.76% ±2.34% ±3.05%
buffers/buffer-compare-offset.js n=1000000 size=16 method='slice' *** -2.59 % ±1.44% ±1.92% ±2.52%
buffers/buffer-compare-offset.js n=1000000 size=16386 method='offset' 0.20 % ±2.09% ±2.79% ±3.63%
buffers/buffer-compare-offset.js n=1000000 size=16386 method='slice' * 1.73 % ±1.50% ±2.01% ±2.62%
buffers/buffer-compare-offset.js n=1000000 size=4096 method='offset' -0.54 % ±2.03% ±2.70% ±3.52%
buffers/buffer-compare-offset.js n=1000000 size=4096 method='slice' -0.98 % ±1.48% ±1.97% ±2.56%
buffers/buffer-compare-offset.js n=1000000 size=512 method='offset' -0.32 % ±1.97% ±2.63% ±3.43%
buffers/buffer-compare-offset.js n=1000000 size=512 method='slice' 0.58 % ±1.84% ±2.45% ±3.19%
buffers/buffer-compare.js n=1000000 size=16 -0.76 % ±1.78% ±2.37% ±3.09%
buffers/buffer-compare.js n=1000000 size=16386 *** -13.81 % ±2.56% ±3.42% ±4.49%
buffers/buffer-compare.js n=1000000 size=4096 -0.92 % ±3.38% ±4.50% ±5.86%
buffers/buffer-compare.js n=1000000 size=512 0.36 % ±1.27% ±1.70% ±2.21%
buffers/buffer-concat-fill.js n=800000 extraSize=1 0.00 % ±0.88% ±1.17% ±1.52%
buffers/buffer-concat-fill.js n=800000 extraSize=1024 0.08 % ±0.93% ±1.24% ±1.62%
buffers/buffer-concat-fill.js n=800000 extraSize=256 0.25 % ±0.98% ±1.31% ±1.70%
buffers/buffer-concat.js n=800000 withTotalLength=0 pieceSize=1 pieces=16 -0.26 % ±0.95% ±1.27% ±1.65%
buffers/buffer-concat.js n=800000 withTotalLength=0 pieceSize=1 pieces=4 -0.54 % ±1.53% ±2.03% ±2.65%
buffers/buffer-concat.js n=800000 withTotalLength=0 pieceSize=16 pieces=16 -0.31 % ±1.44% ±1.92% ±2.50%
buffers/buffer-concat.js n=800000 withTotalLength=0 pieceSize=16 pieces=4 -1.55 % ±1.69% ±2.26% ±2.95%
buffers/buffer-concat.js n=800000 withTotalLength=0 pieceSize=256 pieces=16 0.45 % ±0.59% ±0.79% ±1.02%
buffers/buffer-concat.js n=800000 withTotalLength=0 pieceSize=256 pieces=4 0.78 % ±1.04% ±1.38% ±1.80%
buffers/buffer-concat.js n=800000 withTotalLength=1 pieceSize=1 pieces=16 * -2.35 % ±1.90% ±2.54% ±3.33%
buffers/buffer-concat.js n=800000 withTotalLength=1 pieceSize=1 pieces=4 -0.02 % ±1.98% ±2.63% ±3.42%
buffers/buffer-concat.js n=800000 withTotalLength=1 pieceSize=16 pieces=16 0.69 % ±1.50% ±2.00% ±2.60%
buffers/buffer-concat.js n=800000 withTotalLength=1 pieceSize=16 pieces=4 -0.40 % ±1.89% ±2.52% ±3.28%
buffers/buffer-concat.js n=800000 withTotalLength=1 pieceSize=256 pieces=16 0.32 % ±0.66% ±0.88% ±1.14%
buffers/buffer-concat.js n=800000 withTotalLength=1 pieceSize=256 pieces=4 -0.04 % ±0.95% ±1.26% ±1.64%
buffers/buffer-copy.js n=6000000 partial='false' bytes=1024 *** -41.41 % ±1.43% ±1.92% ±2.54%
buffers/buffer-copy.js n=6000000 partial='false' bytes=128 *** -46.13 % ±2.10% ±2.82% ±3.73%
buffers/buffer-copy.js n=6000000 partial='false' bytes=8 *** -48.07 % ±2.43% ±3.27% ±4.32%
buffers/buffer-copy.js n=6000000 partial='true' bytes=1024 0.31 % ±1.01% ±1.34% ±1.74%
buffers/buffer-copy.js n=6000000 partial='true' bytes=128 ** 1.71 % ±0.99% ±1.32% ±1.72%
buffers/buffer-copy.js n=6000000 partial='true' bytes=8 0.33 % ±1.12% ±1.49% ±1.94%
buffers/buffer-creation.js n=600000 len=10 type='fast-alloc-fill' 0.99 % ±4.90% ±6.52% ±8.49%
buffers/buffer-creation.js n=600000 len=10 type='fast-alloc' 1.46 % ±5.32% ±7.08% ±9.21%
buffers/buffer-creation.js n=600000 len=10 type='fast-allocUnsafe' * 4.83 % ±4.70% ±6.26% ±8.14%
buffers/buffer-creation.js n=600000 len=10 type='slow-allocUnsafe' 1.39 % ±5.64% ±7.50% ±9.77%
buffers/buffer-creation.js n=600000 len=1024 type='fast-alloc-fill' -0.63 % ±0.86% ±1.15% ±1.49%
buffers/buffer-creation.js n=600000 len=1024 type='fast-alloc' 0.06 % ±0.80% ±1.06% ±1.38%
buffers/buffer-creation.js n=600000 len=1024 type='fast-allocUnsafe' -0.51 % ±1.52% ±2.03% ±2.64%
buffers/buffer-creation.js n=600000 len=1024 type='slow-allocUnsafe' -0.01 % ±0.88% ±1.17% ±1.53%
buffers/buffer-creation.js n=600000 len=4096 type='fast-alloc-fill' 0.37 % ±0.94% ±1.26% ±1.66%
buffers/buffer-creation.js n=600000 len=4096 type='fast-alloc' 0.20 % ±0.91% ±1.21% ±1.58%
buffers/buffer-creation.js n=600000 len=4096 type='fast-allocUnsafe' -0.21 % ±0.86% ±1.14% ±1.48%
buffers/buffer-creation.js n=600000 len=4096 type='slow-allocUnsafe' 0.19 % ±0.68% ±0.90% ±1.17%
buffers/buffer-creation.js n=600000 len=8192 type='fast-alloc-fill' -0.70 % ±0.81% ±1.08% ±1.40%
buffers/buffer-creation.js n=600000 len=8192 type='fast-alloc' 0.01 % ±0.74% ±0.98% ±1.28%
buffers/buffer-creation.js n=600000 len=8192 type='fast-allocUnsafe' 0.28 % ±0.80% ±1.06% ±1.39%
buffers/buffer-creation.js n=600000 len=8192 type='slow-allocUnsafe' 0.56 % ±0.92% ±1.23% ±1.60%
buffers/buffer-equals.js n=1000000 difflen='false' size=0 -0.03 % ±3.76% ±5.01% ±6.55%
buffers/buffer-equals.js n=1000000 difflen='false' size=16386 *** 19.68 % ±1.99% ±2.68% ±3.55%
buffers/buffer-equals.js n=1000000 difflen='false' size=512 -0.80 % ±2.29% ±3.05% ±3.98%
buffers/buffer-equals.js n=1000000 difflen='true' size=0 1.95 % ±3.03% ±4.06% ±5.35%
buffers/buffer-equals.js n=1000000 difflen='true' size=16386 2.61 % ±2.86% ±3.83% ±5.03%
buffers/buffer-equals.js n=1000000 difflen='true' size=512 0.20 % ±1.23% ±1.64% ±2.15%
buffers/buffer-fill.js n=20000 size=65536 type='fill("")' -3.26 % ±3.26% ±4.35% ±5.68%
buffers/buffer-fill.js n=20000 size=65536 type='fill("t", "utf8")' 0.69 % ±3.45% ±4.60% ±6.01%
buffers/buffer-fill.js n=20000 size=65536 type='fill("t", 0, "utf8")' 0.23 % ±3.44% ±4.59% ±5.98%
buffers/buffer-fill.js n=20000 size=65536 type='fill("t", 0)' 0.02 % ±1.64% ±2.18% ±2.84%
buffers/buffer-fill.js n=20000 size=65536 type='fill("t")' -0.32 % ±3.78% ±5.03% ±6.55%
buffers/buffer-fill.js n=20000 size=65536 type='fill("test")' -2.57 % ±3.66% ±4.88% ±6.38%
buffers/buffer-fill.js n=20000 size=65536 type='fill(0)' -0.66 % ±1.98% ±2.64% ±3.43%
buffers/buffer-fill.js n=20000 size=65536 type='fill(100)' 0.12 % ±2.23% ±2.97% ±3.87%
buffers/buffer-fill.js n=20000 size=65536 type='fill(400)' -1.11 % ±2.21% ±2.94% ±3.82%
buffers/buffer-fill.js n=20000 size=65536 type='fill(Buffer.alloc(1), 0)' * -4.15 % ±3.29% ±4.39% ±5.72%
buffers/buffer-fill.js n=20000 size=8192 type='fill("")' -0.92 % ±7.59% ±10.10% ±13.15%
buffers/buffer-fill.js n=20000 size=8192 type='fill("t", "utf8")' -1.26 % ±11.97% ±15.93% ±20.74%
buffers/buffer-fill.js n=20000 size=8192 type='fill("t", 0, "utf8")' -0.27 % ±8.22% ±10.94% ±14.24%
buffers/buffer-fill.js n=20000 size=8192 type='fill("t", 0)' -5.22 % ±8.66% ±11.53% ±15.03%
buffers/buffer-fill.js n=20000 size=8192 type='fill("t")' 1.07 % ±11.75% ±15.64% ±20.36%
buffers/buffer-fill.js n=20000 size=8192 type='fill("test")' -4.68 % ±9.07% ±12.08% ±15.74%
buffers/buffer-fill.js n=20000 size=8192 type='fill(0)' 0.37 % ±1.37% ±1.83% ±2.39%
buffers/buffer-fill.js n=20000 size=8192 type='fill(100)' * 2.13 % ±1.82% ±2.42% ±3.15%
buffers/buffer-fill.js n=20000 size=8192 type='fill(400)' 0.76 % ±1.63% ±2.17% ±2.82%
buffers/buffer-fill.js n=20000 size=8192 type='fill(Buffer.alloc(1), 0)' -2.87 % ±10.03% ±13.34% ±17.37%
buffers/buffer-from.js n=800000 len=100 source='array' -0.36 % ±1.48% ±1.97% ±2.57%
buffers/buffer-from.js n=800000 len=100 source='arraybuffer-middle' -3.78 % ±3.91% ±5.21% ±6.80%
buffers/buffer-from.js n=800000 len=100 source='arraybuffer' 1.91 % ±3.80% ±5.06% ±6.59%
buffers/buffer-from.js n=800000 len=100 source='buffer' -0.38 % ±2.60% ±3.46% ±4.51%
buffers/buffer-from.js n=800000 len=100 source='object' 1.92 % ±3.57% ±4.75% ±6.18%
buffers/buffer-from.js n=800000 len=100 source='string-base64' -0.54 % ±1.33% ±1.77% ±2.30%
buffers/buffer-from.js n=800000 len=100 source='string-utf8' -0.28 % ±2.15% ±2.86% ±3.72%
buffers/buffer-from.js n=800000 len=100 source='string' 0.93 % ±1.83% ±2.44% ±3.17%
buffers/buffer-from.js n=800000 len=100 source='uint16array' -0.25 % ±2.20% ±2.93% ±3.81%
buffers/buffer-from.js n=800000 len=100 source='uint8array' ** -4.77 % ±3.06% ±4.08% ±5.33%
buffers/buffer-from.js n=800000 len=2048 source='array' ** -0.38 % ±0.28% ±0.38% ±0.49%
buffers/buffer-from.js n=800000 len=2048 source='arraybuffer-middle' * -3.39 % ±2.69% ±3.58% ±4.67%
buffers/buffer-from.js n=800000 len=2048 source='arraybuffer' -1.50 % ±3.30% ±4.39% ±5.73%
buffers/buffer-from.js n=800000 len=2048 source='buffer' 0.40 % ±1.23% ±1.64% ±2.14%
buffers/buffer-from.js n=800000 len=2048 source='object' -0.90 % ±4.87% ±6.48% ±8.44%
buffers/buffer-from.js n=800000 len=2048 source='string-base64' 0.64 % ±0.81% ±1.08% ±1.40%
buffers/buffer-from.js n=800000 len=2048 source='string-utf8' 0.86 % ±0.89% ±1.18% ±1.54%
buffers/buffer-from.js n=800000 len=2048 source='string' 0.29 % ±1.00% ±1.34% ±1.74%
buffers/buffer-from.js n=800000 len=2048 source='uint16array' 0.30 % ±0.80% ±1.06% ±1.39%
buffers/buffer-from.js n=800000 len=2048 source='uint8array' ** 1.42 % ±0.97% ±1.29% ±1.69%
buffers/buffer-hex-decode.js n=1000000 len=1024 -0.22 % ±0.64% ±0.85% ±1.11%
buffers/buffer-hex-decode.js n=1000000 len=64 0.15 % ±1.93% ±2.58% ±3.36%
buffers/buffer-hex-encode.js n=1000000 len=1024 -0.15 % ±0.23% ±0.31% ±0.40%
buffers/buffer-hex-encode.js n=1000000 len=64 0.22 % ±0.93% ±1.23% ±1.61%
buffers/buffer-indexof-number.js n=1000000 value=64 -0.93 % ±2.86% ±3.80% ±4.95%
buffers/buffer-indexof.js n=50000 type='buffer' encoding='undefined' search='--l' -0.11 % ±0.35% ±0.47% ±0.61%
buffers/buffer-indexof.js n=50000 type='buffer' encoding='undefined' search='@' -7.11 % ±10.22% ±13.61% ±17.71%
buffers/buffer-indexof.js n=50000 type='buffer' encoding='undefined' search='</i> to the Caterpillar' 0.02 % ±0.09% ±0.12% ±0.16%
buffers/buffer-indexof.js n=50000 type='buffer' encoding='undefined' search='aaaaaaaaaaaaaaaaa' 0.07 % ±0.09% ±0.11% ±0.15%
buffers/buffer-indexof.js n=50000 type='buffer' encoding='undefined' search='Alice' -0.49 % ±13.47% ±17.92% ±23.33%
buffers/buffer-indexof.js n=50000 type='buffer' encoding='undefined' search='found it very' 0.00 % ±0.03% ±0.04% ±0.05%
buffers/buffer-indexof.js n=50000 type='buffer' encoding='undefined' search='Gryphon' -0.21 % ±1.70% ±2.26% ±2.95%
buffers/buffer-indexof.js n=50000 type='buffer' encoding='undefined' search='neighbouring pool' 0.06 % ±0.08% ±0.10% ±0.13%
buffers/buffer-indexof.js n=50000 type='buffer' encoding='undefined' search='Ou est ma chatte?' -0.01 % ±0.19% ±0.25% ±0.33%
buffers/buffer-indexof.js n=50000 type='buffer' encoding='undefined' search='SQ' 0.26 % ±2.40% ±3.19% ±4.15%
buffers/buffer-indexof.js n=50000 type='buffer' encoding='undefined' search='venture to go near the house till she had brought herself down to' 1.17 % ±1.76% ±2.37% ±3.14%
buffers/buffer-indexof.js n=50000 type='string' encoding='ucs2' search='--l' -0.49 % ±0.92% ±1.24% ±1.64%
buffers/buffer-indexof.js n=50000 type='string' encoding='ucs2' search='@' ** 8.41 % ±5.40% ±7.23% ±9.50%
buffers/buffer-indexof.js n=50000 type='string' encoding='ucs2' search='</i> to the Caterpillar' -1.33 % ±2.73% ±3.64% ±4.74%
buffers/buffer-indexof.js n=50000 type='string' encoding='ucs2' search='aaaaaaaaaaaaaaaaa' 1.45 % ±3.20% ±4.27% ±5.59%
buffers/buffer-indexof.js n=50000 type='string' encoding='ucs2' search='Alice' 9.85 % ±10.01% ±13.34% ±17.40%
buffers/buffer-indexof.js n=50000 type='string' encoding='ucs2' search='found it very' 0.07 % ±0.47% ±0.63% ±0.82%
buffers/buffer-indexof.js n=50000 type='string' encoding='ucs2' search='Gryphon' 0.49 % ±1.06% ±1.42% ±1.87%
buffers/buffer-indexof.js n=50000 type='string' encoding='ucs2' search='neighbouring pool' 0.23 % ±2.35% ±3.12% ±4.06%
buffers/buffer-indexof.js n=50000 type='string' encoding='ucs2' search='Ou est ma chatte?' -0.54 % ±2.01% ±2.68% ±3.49%
buffers/buffer-indexof.js n=50000 type='string' encoding='ucs2' search='SQ' -0.32 % ±1.46% ±1.95% ±2.53%
buffers/buffer-indexof.js n=50000 type='string' encoding='ucs2' search='venture to go near the house till she had brought herself down to' -0.70 % ±1.17% ±1.57% ±2.08%
buffers/buffer-indexof.js n=50000 type='string' encoding='utf8' search='--l' -0.01 % ±0.40% ±0.53% ±0.69%
buffers/buffer-indexof.js n=50000 type='string' encoding='utf8' search='@' -1.01 % ±6.22% ±8.28% ±10.78%
buffers/buffer-indexof.js n=50000 type='string' encoding='utf8' search='</i> to the Caterpillar' -0.20 % ±1.45% ±1.93% ±2.51%
buffers/buffer-indexof.js n=50000 type='string' encoding='utf8' search='aaaaaaaaaaaaaaaaa' 1.09 % ±1.50% ±2.02% ±2.67%
buffers/buffer-indexof.js n=50000 type='string' encoding='utf8' search='Alice' -1.49 % ±9.52% ±12.67% ±16.49%
buffers/buffer-indexof.js n=50000 type='string' encoding='utf8' search='found it very' -0.23 % ±0.82% ±1.10% ±1.43%
buffers/buffer-indexof.js n=50000 type='string' encoding='utf8' search='Gryphon' -0.12 % ±0.72% ±0.96% ±1.24%
buffers/buffer-indexof.js n=50000 type='string' encoding='utf8' search='neighbouring pool' -0.25 % ±0.78% ±1.04% ±1.36%
buffers/buffer-indexof.js n=50000 type='string' encoding='utf8' search='Ou est ma chatte?' ** -0.18 % ±0.12% ±0.15% ±0.20%
buffers/buffer-indexof.js n=50000 type='string' encoding='utf8' search='SQ' -0.49 % ±2.56% ±3.41% ±4.44%
buffers/buffer-indexof.js n=50000 type='string' encoding='utf8' search='venture to go near the house till she had brought herself down to' -0.03 % ±0.19% ±0.26% ±0.34%
buffers/buffer-isascii.js input='hello world' length='long' n=20000000 *** 7.46 % ±2.43% ±3.24% ±4.24%
buffers/buffer-isascii.js input='hello world' length='short' n=20000000 ** 3.50 % ±2.36% ±3.15% ±4.13%
buffers/buffer-isutf8.js input='∀x∈ℝ: ⌈x⌉ = −⌊−x⌋' length='long' n=20000000 0.04 % ±0.10% ±0.13% ±0.17%
buffers/buffer-isutf8.js input='∀x∈ℝ: ⌈x⌉ = −⌊−x⌋' length='short' n=20000000 0.52 % ±1.19% ±1.59% ±2.07%
buffers/buffer-isutf8.js input='regular string' length='long' n=20000000 1.82 % ±4.96% ±6.60% ±8.59%
buffers/buffer-isutf8.js input='regular string' length='short' n=20000000 0.36 % ±0.84% ±1.12% ±1.47%
buffers/buffer-iterate.js n=1000 method='for' type='fast' size=16386 1.36 % ±4.86% ±6.46% ±8.41%
buffers/buffer-iterate.js n=1000 method='for' type='fast' size=4096 -1.03 % ±7.65% ±10.18% ±13.27%
buffers/buffer-iterate.js n=1000 method='for' type='fast' size=512 2.46 % ±17.28% ±22.99% ±29.93%
buffers/buffer-iterate.js n=1000 method='forOf' type='fast' size=16386 -0.51 % ±1.34% ±1.78% ±2.32%
buffers/buffer-iterate.js n=1000 method='forOf' type='fast' size=4096 -4.18 % ±5.54% ±7.37% ±9.60%
buffers/buffer-iterate.js n=1000 method='forOf' type='fast' size=512 0.69 % ±14.00% ±18.63% ±24.24%
buffers/buffer-iterate.js n=1000 method='iterator' type='fast' size=16386 -0.39 % ±1.38% ±1.83% ±2.38%
buffers/buffer-iterate.js n=1000 method='iterator' type='fast' size=4096 1.00 % ±2.69% ±3.58% ±4.66%
buffers/buffer-iterate.js n=1000 method='iterator' type='fast' size=512 3.66 % ±12.68% ±16.87% ±21.96%
buffers/buffer-normalize-encoding.js n=1000000 encoding='ascii' 2.84 % ±3.30% ±4.41% ±5.78%
buffers/buffer-normalize-encoding.js n=1000000 encoding='base64' 0.59 % ±1.55% ±2.06% ±2.68%
buffers/buffer-normalize-encoding.js n=1000000 encoding='BASE64' 1.12 % ±4.06% ±5.42% ±7.09%
buffers/buffer-normalize-encoding.js n=1000000 encoding='binary' -0.35 % ±4.58% ±6.10% ±7.94%
buffers/buffer-normalize-encoding.js n=1000000 encoding='hex' 0.00 % ±1.17% ±1.56% ±2.04%
buffers/buffer-normalize-encoding.js n=1000000 encoding='HEX' 1.75 % ±5.29% ±7.04% ±9.17%
buffers/buffer-normalize-encoding.js n=1000000 encoding='latin1' -1.70 % ±5.14% ±6.84% ±8.90%
buffers/buffer-normalize-encoding.js n=1000000 encoding='LATIN1' -2.37 % ±3.33% ±4.43% ±5.78%
buffers/buffer-normalize-encoding.js n=1000000 encoding='UCS-2' -0.47 % ±3.59% ±4.78% ±6.22%
buffers/buffer-normalize-encoding.js n=1000000 encoding='UCS2' -1.01 % ±3.89% ±5.18% ±6.75%
buffers/buffer-normalize-encoding.js n=1000000 encoding='utf-16le' 0.48 % ±2.09% ±2.79% ±3.63%
buffers/buffer-normalize-encoding.js n=1000000 encoding='UTF-16LE' -0.98 % ±5.11% ±6.81% ±8.86%
buffers/buffer-normalize-encoding.js n=1000000 encoding='utf-8' -0.72 % ±1.50% ±1.99% ±2.59%
buffers/buffer-normalize-encoding.js n=1000000 encoding='utf16le' -0.51 % ±1.48% ±1.97% ±2.57%
buffers/buffer-normalize-encoding.js n=1000000 encoding='UTF16LE' -4.09 % ±5.13% ±6.82% ±8.88%
buffers/buffer-normalize-encoding.js n=1000000 encoding='utf8' -0.84 % ±1.22% ±1.63% ±2.12%
buffers/buffer-normalize-encoding.js n=1000000 encoding='UTF8' -0.57 % ±1.92% ±2.55% ±3.32%
buffers/buffer-read-float.js n=1000000 value='big' endian='LE' type='Double' 12.67 % ±17.39% ±23.14% ±30.12%
buffers/buffer-read-float.js n=1000000 value='big' endian='LE' type='Float' 4.28 % ±18.35% ±24.41% ±31.78%
buffers/buffer-read-float.js n=1000000 value='inf' endian='LE' type='Double' -0.48 % ±16.82% ±22.38% ±29.13%
buffers/buffer-read-float.js n=1000000 value='inf' endian='LE' type='Float' -12.07 % ±16.67% ±22.21% ±28.97%
buffers/buffer-read-float.js n=1000000 value='nan' endian='LE' type='Double' -4.55 % ±16.65% ±22.15% ±28.83%
buffers/buffer-read-float.js n=1000000 value='nan' endian='LE' type='Float' -8.69 % ±16.20% ±21.57% ±28.10%
buffers/buffer-read-float.js n=1000000 value='small' endian='LE' type='Double' 4.88 % ±16.50% ±21.95% ±28.57%
buffers/buffer-read-float.js n=1000000 value='small' endian='LE' type='Float' -3.27 % ±15.74% ±20.95% ±27.27%
buffers/buffer-read-float.js n=1000000 value='zero' endian='LE' type='Double' 3.49 % ±13.03% ±17.33% ±22.56%
buffers/buffer-read-float.js n=1000000 value='zero' endian='LE' type='Float' -5.15 % ±12.46% ±16.58% ±21.59%
buffers/buffer-read-with-byteLength.js byteLength=1 n=1000000 type='IntBE' buffer='fast' 1.94 % ±12.21% ±16.25% ±21.15%
buffers/buffer-read-with-byteLength.js byteLength=1 n=1000000 type='IntLE' buffer='fast' 2.38 % ±10.75% ±14.31% ±18.63%
buffers/buffer-read-with-byteLength.js byteLength=1 n=1000000 type='UIntBE' buffer='fast' 1.26 % ±12.83% ±17.08% ±22.22%
buffers/buffer-read-with-byteLength.js byteLength=1 n=1000000 type='UIntLE' buffer='fast' 0.78 % ±9.44% ±12.56% ±16.36%
buffers/buffer-read-with-byteLength.js byteLength=2 n=1000000 type='IntBE' buffer='fast' 0.58 % ±15.47% ±20.58% ±26.79%
buffers/buffer-read-with-byteLength.js byteLength=2 n=1000000 type='IntLE' buffer='fast' 8.51 % ±15.54% ±20.67% ±26.91%
buffers/buffer-read-with-byteLength.js byteLength=2 n=1000000 type='UIntBE' buffer='fast' -7.37 % ±10.08% ±13.43% ±17.51%
buffers/buffer-read-with-byteLength.js byteLength=2 n=1000000 type='UIntLE' buffer='fast' -3.82 % ±14.12% ±18.78% ±24.44%
buffers/buffer-read-with-byteLength.js byteLength=3 n=1000000 type='IntBE' buffer='fast' 2.12 % ±14.21% ±18.90% ±24.60%
buffers/buffer-read-with-byteLength.js byteLength=3 n=1000000 type='IntLE' buffer='fast' ** 22.65 % ±15.09% ±20.08% ±26.14%
buffers/buffer-read-with-byteLength.js byteLength=3 n=1000000 type='UIntBE' buffer='fast' -1.84 % ±15.32% ±20.38% ±26.52%
buffers/buffer-read-with-byteLength.js byteLength=3 n=1000000 type='UIntLE' buffer='fast' 1.57 % ±6.82% ±9.07% ±11.81%
buffers/buffer-read-with-byteLength.js byteLength=4 n=1000000 type='IntBE' buffer='fast' 7.12 % ±15.46% ±20.57% ±26.77%
buffers/buffer-read-with-byteLength.js byteLength=4 n=1000000 type='IntLE' buffer='fast' -12.22 % ±14.25% ±18.96% ±24.69%
buffers/buffer-read-with-byteLength.js byteLength=4 n=1000000 type='UIntBE' buffer='fast' 5.63 % ±15.52% ±20.66% ±26.89%
buffers/buffer-read-with-byteLength.js byteLength=4 n=1000000 type='UIntLE' buffer='fast' -4.44 % ±15.08% ±20.06% ±26.11%
buffers/buffer-read-with-byteLength.js byteLength=5 n=1000000 type='IntBE' buffer='fast' -1.65 % ±9.53% ±12.68% ±16.51%
buffers/buffer-read-with-byteLength.js byteLength=5 n=1000000 type='IntLE' buffer='fast' -0.47 % ±10.35% ±13.77% ±17.93%
buffers/buffer-read-with-byteLength.js byteLength=5 n=1000000 type='UIntBE' buffer='fast' -5.76 % ±11.67% ±15.53% ±20.21%
buffers/buffer-read-with-byteLength.js byteLength=5 n=1000000 type='UIntLE' buffer='fast' 3.80 % ±9.38% ±12.50% ±16.29%
buffers/buffer-read-with-byteLength.js byteLength=6 n=1000000 type='IntBE' buffer='fast' -1.41 % ±7.21% ±9.60% ±12.50%
buffers/buffer-read-with-byteLength.js byteLength=6 n=1000000 type='IntLE' buffer='fast' -0.46 % ±7.90% ±10.51% ±13.69%
buffers/buffer-read-with-byteLength.js byteLength=6 n=1000000 type='UIntBE' buffer='fast' 4.10 % ±9.28% ±12.36% ±16.09%
buffers/buffer-read-with-byteLength.js byteLength=6 n=1000000 type='UIntLE' buffer='fast' 1.20 % ±10.15% ±13.51% ±17.58%
buffers/buffer-read.js n=1000000 type='BigInt64BE' buffer='fast' * -8.01 % ±6.77% ±9.01% ±11.73%
buffers/buffer-read.js n=1000000 type='BigInt64LE' buffer='fast' -1.32 % ±6.12% ±8.15% ±10.63%
buffers/buffer-read.js n=1000000 type='BigUInt64BE' buffer='fast' 7.86 % ±20.04% ±26.66% ±34.70%
buffers/buffer-read.js n=1000000 type='BigUInt64LE' buffer='fast' -7.50 % ±14.80% ±19.69% ±25.63%
buffers/buffer-read.js n=1000000 type='Int16BE' buffer='fast' -4.74 % ±17.59% ±23.41% ±30.46%
buffers/buffer-read.js n=1000000 type='Int16LE' buffer='fast' -13.30 % ±18.89% ±25.13% ±32.70%
buffers/buffer-read.js n=1000000 type='Int32BE' buffer='fast' -4.74 % ±19.42% ±25.83% ±33.62%
buffers/buffer-read.js n=1000000 type='Int32LE' buffer='fast' -7.69 % ±16.69% ±22.20% ±28.90%
buffers/buffer-read.js n=1000000 type='Int8' buffer='fast' -13.45 % ±19.64% ±26.13% ±34.01%
buffers/buffer-read.js n=1000000 type='UInt16BE' buffer='fast' -12.52 % ±17.23% ±22.93% ±29.84%
buffers/buffer-read.js n=1000000 type='UInt16LE' buffer='fast' -6.06 % ±17.94% ±23.87% ±31.06%
buffers/buffer-read.js n=1000000 type='UInt32BE' buffer='fast' 14.02 % ±22.28% ±29.64% ±38.58%
buffers/buffer-read.js n=1000000 type='UInt32LE' buffer='fast' 3.69 % ±21.77% ±28.97% ±37.70%
buffers/buffer-read.js n=1000000 type='UInt8' buffer='fast' * -13.41 % ±12.29% ±16.38% ±21.40%
buffers/buffer-slice.js n=1000000 type='fast' -0.57 % ±2.60% ±3.47% ±4.51%
buffers/buffer-slice.js n=1000000 type='slow' -0.64 % ±2.99% ±3.98% ±5.18%
buffers/buffer-slice.js n=1000000 type='subarray' 2.00 % ±3.82% ±5.09% ±6.65%
buffers/buffer-swap.js n=1000000 len=1024 method='swap16' aligned='false' -0.18 % ±0.77% ±1.03% ±1.34%
buffers/buffer-swap.js n=1000000 len=1024 method='swap16' aligned='true' -0.37 % ±0.98% ±1.31% ±1.71%
buffers/buffer-swap.js n=1000000 len=1024 method='swap32' aligned='false' 0.04 % ±0.68% ±0.91% ±1.19%
buffers/buffer-swap.js n=1000000 len=1024 method='swap32' aligned='true' -0.23 % ±0.55% ±0.73% ±0.95%
buffers/buffer-swap.js n=1000000 len=1024 method='swap64' aligned='false' 0.20 % ±0.62% ±0.82% ±1.07%
buffers/buffer-swap.js n=1000000 len=1024 method='swap64' aligned='true' -0.38 % ±0.56% ±0.74% ±0.96%
buffers/buffer-swap.js n=1000000 len=2056 method='swap16' aligned='false' -0.17 % ±0.65% ±0.86% ±1.12%
buffers/buffer-swap.js n=1000000 len=2056 method='swap16' aligned='true' -0.03 % ±0.61% ±0.81% ±1.05%
buffers/buffer-swap.js n=1000000 len=2056 method='swap32' aligned='false' * 0.35 % ±0.35% ±0.46% ±0.60%
buffers/buffer-swap.js n=1000000 len=2056 method='swap32' aligned='true' 0.13 % ±0.29% ±0.39% ±0.50%
buffers/buffer-swap.js n=1000000 len=2056 method='swap64' aligned='false' -0.09 % ±0.34% ±0.46% ±0.60%
buffers/buffer-swap.js n=1000000 len=2056 method='swap64' aligned='true' 0.17 % ±0.34% ±0.45% ±0.59%
buffers/buffer-swap.js n=1000000 len=256 method='swap16' aligned='false' 1.35 % ±1.40% ±1.86% ±2.42%
buffers/buffer-swap.js n=1000000 len=256 method='swap16' aligned='true' 1.02 % ±1.76% ±2.34% ±3.05%
buffers/buffer-swap.js n=1000000 len=256 method='swap32' aligned='false' -1.64 % ±1.95% ±2.60% ±3.39%
buffers/buffer-swap.js n=1000000 len=256 method='swap32' aligned='true' 0.64 % ±1.62% ±2.16% ±2.82%
buffers/buffer-swap.js n=1000000 len=256 method='swap64' aligned='false' -0.62 % ±1.45% ±1.93% ±2.51%
buffers/buffer-swap.js n=1000000 len=256 method='swap64' aligned='true' -0.94 % ±1.87% ±2.49% ±3.24%
buffers/buffer-swap.js n=1000000 len=64 method='swap16' aligned='false' -0.09 % ±0.94% ±1.25% ±1.62%
buffers/buffer-swap.js n=1000000 len=64 method='swap16' aligned='true' 1.51 % ±2.12% ±2.82% ±3.68%
buffers/buffer-swap.js n=1000000 len=64 method='swap32' aligned='false' 0.17 % ±0.48% ±0.64% ±0.83%
buffers/buffer-swap.js n=1000000 len=64 method='swap32' aligned='true' -0.14 % ±0.57% ±0.76% ±0.99%
buffers/buffer-swap.js n=1000000 len=64 method='swap64' aligned='false' -0.59 % ±0.99% ±1.32% ±1.72%
buffers/buffer-swap.js n=1000000 len=64 method='swap64' aligned='true' -0.57 % ±1.19% ±1.58% ±2.06%
buffers/buffer-swap.js n=1000000 len=768 method='swap16' aligned='false' 0.49 % ±0.85% ±1.13% ±1.47%
buffers/buffer-swap.js n=1000000 len=768 method='swap16' aligned='true' 1.14 % ±1.19% ±1.58% ±2.07%
buffers/buffer-swap.js n=1000000 len=768 method='swap32' aligned='false' 0.87 % ±1.02% ±1.36% ±1.77%
buffers/buffer-swap.js n=1000000 len=768 method='swap32' aligned='true' 0.12 % ±1.01% ±1.35% ±1.76%
buffers/buffer-swap.js n=1000000 len=768 method='swap64' aligned='false' 0.35 % ±0.68% ±0.90% ±1.18%
buffers/buffer-swap.js n=1000000 len=768 method='swap64' aligned='true' 0.10 % ±0.72% ±0.95% ±1.24%
buffers/buffer-swap.js n=1000000 len=8192 method='swap16' aligned='false' 0.13 % ±0.15% ±0.20% ±0.26%
buffers/buffer-swap.js n=1000000 len=8192 method='swap16' aligned='true' 0.09 % ±0.15% ±0.20% ±0.26%
buffers/buffer-swap.js n=1000000 len=8192 method='swap32' aligned='false' 0.08 % ±0.08% ±0.11% ±0.14%
buffers/buffer-swap.js n=1000000 len=8192 method='swap32' aligned='true' -0.01 % ±0.07% ±0.09% ±0.12%
buffers/buffer-swap.js n=1000000 len=8192 method='swap64' aligned='false' -0.04 % ±0.10% ±0.13% ±0.17%
buffers/buffer-swap.js n=1000000 len=8192 method='swap64' aligned='true' -0.02 % ±0.10% ±0.13% ±0.17%
buffers/buffer-tojson.js len=0 n=10000 -3.37 % ±18.74% ±24.93% ±32.45%
buffers/buffer-tojson.js len=256 n=10000 -0.92 % ±1.76% ±2.34% ±3.05%
buffers/buffer-tojson.js len=4096 n=10000 1.57 % ±1.65% ±2.19% ±2.86%
buffers/buffer-tostring.js n=1000000 len=1 args=0 encoding='' -2.46 % ±2.61% ±3.48% ±4.53%
buffers/buffer-tostring.js n=1000000 len=1 args=1 encoding='ascii' -0.89 % ±2.57% ±3.43% ±4.46%
buffers/buffer-tostring.js n=1000000 len=1 args=1 encoding='hex' 0.40 % ±2.40% ±3.19% ±4.15%
buffers/buffer-tostring.js n=1000000 len=1 args=1 encoding='latin1' -0.89 % ±4.04% ±5.38% ±7.02%
buffers/buffer-tostring.js n=1000000 len=1 args=1 encoding='UCS-2' 0.87 % ±2.14% ±2.84% ±3.70%
buffers/buffer-tostring.js n=1000000 len=1 args=1 encoding='utf8' 2.43 % ±3.01% ±4.00% ±5.21%
buffers/buffer-tostring.js n=1000000 len=1 args=3 encoding='ascii' -0.06 % ±3.26% ±4.33% ±5.64%
buffers/buffer-tostring.js n=1000000 len=1 args=3 encoding='hex' 0.51 % ±1.88% ±2.50% ±3.26%
buffers/buffer-tostring.js n=1000000 len=1 args=3 encoding='latin1' 0.91 % ±2.92% ±3.89% ±5.07%
buffers/buffer-tostring.js n=1000000 len=1 args=3 encoding='UCS-2' -0.28 % ±1.49% ±1.99% ±2.59%
buffers/buffer-tostring.js n=1000000 len=1 args=3 encoding='utf8' 0.10 % ±3.34% ±4.44% ±5.78%
buffers/buffer-tostring.js n=1000000 len=1024 args=0 encoding='' -0.44 % ±1.18% ±1.58% ±2.05%
buffers/buffer-tostring.js n=1000000 len=1024 args=1 encoding='ascii' 0.19 % ±1.18% ±1.57% ±2.05%
buffers/buffer-tostring.js n=1000000 len=1024 args=1 encoding='hex' 0.53 % ±0.66% ±0.88% ±1.15%
buffers/buffer-tostring.js n=1000000 len=1024 args=1 encoding='latin1' -0.72 % ±1.57% ±2.09% ±2.72%
buffers/buffer-tostring.js n=1000000 len=1024 args=1 encoding='UCS-2' 0.54 % ±0.94% ±1.25% ±1.63%
buffers/buffer-tostring.js n=1000000 len=1024 args=1 encoding='utf8' * 1.64 % ±1.37% ±1.82% ±2.37%
buffers/buffer-tostring.js n=1000000 len=1024 args=3 encoding='ascii' 1.20 % ±1.38% ±1.83% ±2.39%
buffers/buffer-tostring.js n=1000000 len=1024 args=3 encoding='hex' 0.21 % ±0.56% ±0.75% ±0.98%
buffers/buffer-tostring.js n=1000000 len=1024 args=3 encoding='latin1' -0.67 % ±1.28% ±1.70% ±2.22%
buffers/buffer-tostring.js n=1000000 len=1024 args=3 encoding='UCS-2' -0.69 % ±0.88% ±1.17% ±1.52%
buffers/buffer-tostring.js n=1000000 len=1024 args=3 encoding='utf8' 0.75 % ±1.38% ±1.83% ±2.39%
buffers/buffer-tostring.js n=1000000 len=64 args=0 encoding='' 0.64 % ±1.76% ±2.34% ±3.05%
buffers/buffer-tostring.js n=1000000 len=64 args=1 encoding='ascii' -0.29 % ±1.49% ±1.98% ±2.59%
buffers/buffer-tostring.js n=1000000 len=64 args=1 encoding='hex' 1.19 % ±2.12% ±2.82% ±3.67%
buffers/buffer-tostring.js n=1000000 len=64 args=1 encoding='latin1' 0.75 % ±2.18% ±2.89% ±3.77%
buffers/buffer-tostring.js n=1000000 len=64 args=1 encoding='UCS-2' -0.06 % ±1.30% ±1.74% ±2.26%
buffers/buffer-tostring.js n=1000000 len=64 args=1 encoding='utf8' -1.67 % ±3.59% ±4.81% ±6.35%
buffers/buffer-tostring.js n=1000000 len=64 args=3 encoding='ascii' 0.64 % ±1.74% ±2.32% ±3.02%
buffers/buffer-tostring.js n=1000000 len=64 args=3 encoding='hex' -2.00 % ±2.31% ±3.07% ±4.00%
buffers/buffer-tostring.js n=1000000 len=64 args=3 encoding='latin1' -0.70 % ±2.06% ±2.75% ±3.58%
buffers/buffer-tostring.js n=1000000 len=64 args=3 encoding='UCS-2' 0.38 % ±1.90% ±2.53% ±3.31%
buffers/buffer-tostring.js n=1000000 len=64 args=3 encoding='utf8' 1.27 % ±1.67% ±2.22% ±2.89%
buffers/buffer-transcode.js n=100000 length=1 toEncoding='ascii' fromEncoding='ascii' -0.17 % ±1.73% ±2.30% ±2.99%
buffers/buffer-transcode.js n=100000 length=1 toEncoding='ascii' fromEncoding='latin1' -0.12 % ±1.67% ±2.22% ±2.90%
buffers/buffer-transcode.js n=100000 length=1 toEncoding='ascii' fromEncoding='ucs2' -0.87 % ±2.23% ±2.96% ±3.86%
buffers/buffer-transcode.js n=100000 length=1 toEncoding='ascii' fromEncoding='utf8' 0.65 % ±1.86% ±2.47% ±3.22%
buffers/buffer-transcode.js n=100000 length=1 toEncoding='latin1' fromEncoding='ascii' -0.30 % ±1.47% ±1.96% ±2.55%
buffers/buffer-transcode.js n=100000 length=1 toEncoding='latin1' fromEncoding='latin1' 0.40 % ±1.18% ±1.57% ±2.05%
buffers/buffer-transcode.js n=100000 length=1 toEncoding='latin1' fromEncoding='ucs2' 0.47 % ±1.83% ±2.44% ±3.17%
buffers/buffer-transcode.js n=100000 length=1 toEncoding='latin1' fromEncoding='utf8' -0.43 % ±1.70% ±2.26% ±2.96%
buffers/buffer-transcode.js n=100000 length=1 toEncoding='ucs2' fromEncoding='ascii' -1.43 % ±1.92% ±2.55% ±3.33%
buffers/buffer-transcode.js n=100000 length=1 toEncoding='ucs2' fromEncoding='latin1' 0.62 % ±2.07% ±2.75% ±3.58%
buffers/buffer-transcode.js n=100000 length=1 toEncoding='ucs2' fromEncoding='ucs2' -0.48 % ±1.67% ±2.22% ±2.90%
buffers/buffer-transcode.js n=100000 length=1 toEncoding='ucs2' fromEncoding='utf8' -1.15 % ±1.93% ±2.57% ±3.35%
buffers/buffer-transcode.js n=100000 length=1 toEncoding='utf8' fromEncoding='ascii' -0.08 % ±1.43% ±1.90% ±2.47%
buffers/buffer-transcode.js n=100000 length=1 toEncoding='utf8' fromEncoding='latin1' -0.39 % ±1.42% ±1.89% ±2.46%
buffers/buffer-transcode.js n=100000 length=1 toEncoding='utf8' fromEncoding='utf8' 0.17 % ±1.50% ±1.99% ±2.59%
buffers/buffer-transcode.js n=100000 length=10 toEncoding='ascii' fromEncoding='ascii' 0.97 % ±1.80% ±2.40% ±3.12%
buffers/buffer-transcode.js n=100000 length=10 toEncoding='ascii' fromEncoding='latin1' 0.56 % ±1.73% ±2.30% ±3.00%
buffers/buffer-transcode.js n=100000 length=10 toEncoding='ascii' fromEncoding='ucs2' 0.85 % ±1.42% ±1.89% ±2.46%
buffers/buffer-transcode.js n=100000 length=10 toEncoding='ascii' fromEncoding='utf8' -0.70 % ±1.95% ±2.59% ±3.37%
buffers/buffer-transcode.js n=100000 length=10 toEncoding='latin1' fromEncoding='ascii' -0.60 % ±1.64% ±2.19% ±2.85%
buffers/buffer-transcode.js n=100000 length=10 toEncoding='latin1' fromEncoding='latin1' -0.91 % ±1.53% ±2.03% ±2.65%
buffers/buffer-transcode.js n=100000 length=10 toEncoding='latin1' fromEncoding='ucs2' 1.30 % ±1.82% ±2.42% ±3.15%
buffers/buffer-transcode.js n=100000 length=10 toEncoding='latin1' fromEncoding='utf8' -0.13 % ±1.85% ±2.46% ±3.20%
buffers/buffer-transcode.js n=100000 length=10 toEncoding='ucs2' fromEncoding='ascii' ** 2.59 % ±1.69% ±2.25% ±2.93%
buffers/buffer-transcode.js n=100000 length=10 toEncoding='ucs2' fromEncoding='latin1' -0.55 % ±1.63% ±2.17% ±2.83%
buffers/buffer-transcode.js n=100000 length=10 toEncoding='ucs2' fromEncoding='ucs2' ** 2.05 % ±1.53% ±2.04% ±2.66%
buffers/buffer-transcode.js n=100000 length=10 toEncoding='ucs2' fromEncoding='utf8' 1.26 % ±1.69% ±2.25% ±2.94%
buffers/buffer-transcode.js n=100000 length=10 toEncoding='utf8' fromEncoding='ascii' 1.05 % ±2.11% ±2.80% ±3.65%
buffers/buffer-transcode.js n=100000 length=10 toEncoding='utf8' fromEncoding='latin1' * -1.60 % ±1.58% ±2.10% ±2.73%
buffers/buffer-transcode.js n=100000 length=10 toEncoding='utf8' fromEncoding='utf8' * -1.89 % ±1.75% ±2.33% ±3.03%
buffers/buffer-transcode.js n=100000 length=1000 toEncoding='ascii' fromEncoding='ascii' -0.93 % ±1.16% ±1.54% ±2.00%
buffers/buffer-transcode.js n=100000 length=1000 toEncoding='ascii' fromEncoding='latin1' 0.38 % ±1.21% ±1.61% ±2.09%
buffers/buffer-transcode.js n=100000 length=1000 toEncoding='ascii' fromEncoding='ucs2' -0.02 % ±0.22% ±0.30% ±0.39%
buffers/buffer-transcode.js n=100000 length=1000 toEncoding='ascii' fromEncoding='utf8' -1.32 % ±1.38% ±1.84% ±2.39%
buffers/buffer-transcode.js n=100000 length=1000 toEncoding='latin1' fromEncoding='ascii' 0.08 % ±0.94% ±1.25% ±1.63%
buffers/buffer-transcode.js n=100000 length=1000 toEncoding='latin1' fromEncoding='latin1' -0.24 % ±0.85% ±1.13% ±1.47%
buffers/buffer-transcode.js n=100000 length=1000 toEncoding='latin1' fromEncoding='ucs2' -0.15 % ±0.24% ±0.33% ±0.42%
buffers/buffer-transcode.js n=100000 length=1000 toEncoding='latin1' fromEncoding='utf8' -0.84 % ±0.87% ±1.16% ±1.52%
buffers/buffer-transcode.js n=100000 length=1000 toEncoding='ucs2' fromEncoding='ascii' 0.54 % ±1.04% ±1.38% ±1.80%
buffers/buffer-transcode.js n=100000 length=1000 toEncoding='ucs2' fromEncoding='latin1' 0.27 % ±1.02% ±1.35% ±1.76%
buffers/buffer-transcode.js n=100000 length=1000 toEncoding='ucs2' fromEncoding='ucs2' -0.08 % ±0.68% ±0.90% ±1.17%
buffers/buffer-transcode.js n=100000 length=1000 toEncoding='ucs2' fromEncoding='utf8' -0.05 % ±1.00% ±1.33% ±1.73%
buffers/buffer-transcode.js n=100000 length=1000 toEncoding='utf8' fromEncoding='ascii' 0.05 % ±0.72% ±0.96% ±1.25%
buffers/buffer-transcode.js n=100000 length=1000 toEncoding='utf8' fromEncoding='latin1' -0.15 % ±0.80% ±1.06% ±1.39%
buffers/buffer-transcode.js n=100000 length=1000 toEncoding='utf8' fromEncoding='utf8' 0.01 % ±0.80% ±1.07% ±1.39%
buffers/buffer-write-string-short.js n=1000000 len=1 encoding='ascii' -0.18 % ±2.78% ±3.70% ±4.82%
buffers/buffer-write-string-short.js n=1000000 len=1 encoding='latin1' 0.84 % ±3.55% ±4.73% ±6.17%
buffers/buffer-write-string-short.js n=1000000 len=1 encoding='utf8' -0.39 % ±3.56% ±4.74% ±6.17%
buffers/buffer-write-string-short.js n=1000000 len=16 encoding='ascii' 1.37 % ±3.10% ±4.13% ±5.38%
buffers/buffer-write-string-short.js n=1000000 len=16 encoding='latin1' * -3.83 % ±3.64% ±4.84% ±6.31%
buffers/buffer-write-string-short.js n=1000000 len=16 encoding='utf8' 0.96 % ±3.94% ±5.25% ±6.86%
buffers/buffer-write-string-short.js n=1000000 len=32 encoding='ascii' -0.43 % ±2.51% ±3.34% ±4.35%
buffers/buffer-write-string-short.js n=1000000 len=32 encoding='latin1' 1.58 % ±3.93% ±5.23% ±6.82%
buffers/buffer-write-string-short.js n=1000000 len=32 encoding='utf8' -1.31 % ±3.94% ±5.24% ±6.83%
buffers/buffer-write-string-short.js n=1000000 len=8 encoding='ascii' -0.92 % ±3.97% ±5.28% ±6.88%
buffers/buffer-write-string-short.js n=1000000 len=8 encoding='latin1' 1.63 % ±4.12% ±5.48% ±7.13%
buffers/buffer-write-string-short.js n=1000000 len=8 encoding='utf8' -1.75 % ±3.29% ±4.37% ±5.69%
buffers/buffer-write-string.js n=1000000 len=2048 args='' encoding='' -0.01 % ±0.28% ±0.37% ±0.48%
buffers/buffer-write-string.js n=1000000 len=2048 args='' encoding='ascii' *** -2.90 % ±1.58% ±2.12% ±2.77%
buffers/buffer-write-string.js n=1000000 len=2048 args='' encoding='hex' 0.45 % ±0.68% ±0.91% ±1.18%
buffers/buffer-write-string.js n=1000000 len=2048 args='' encoding='latin1' -0.24 % ±1.40% ±1.86% ±2.42%
buffers/buffer-write-string.js n=1000000 len=2048 args='' encoding='utf16le' 0.55 % ±1.22% ±1.63% ±2.12%
buffers/buffer-write-string.js n=1000000 len=2048 args='' encoding='utf8' ** 0.75 % ±0.54% ±0.72% ±0.94%
buffers/buffer-write-string.js n=1000000 len=2048 args='offset' encoding='' 0.65 % ±1.03% ±1.37% ±1.79%
buffers/buffer-write-string.js n=1000000 len=2048 args='offset' encoding='ascii' 2.36 % ±3.67% ±4.88% ±6.35%
buffers/buffer-write-string.js n=1000000 len=2048 args='offset' encoding='hex' *** -1.48 % ±0.85% ±1.13% ±1.48%
buffers/buffer-write-string.js n=1000000 len=2048 args='offset' encoding='latin1' 0.56 % ±3.34% ±4.44% ±5.78%
buffers/buffer-write-string.js n=1000000 len=2048 args='offset' encoding='utf16le' ** 3.11 % ±2.14% ±2.84% ±3.70%
buffers/buffer-write-string.js n=1000000 len=2048 args='offset' encoding='utf8' ** 2.24 % ±1.57% ±2.09% ±2.72%
buffers/buffer-write-string.js n=1000000 len=2048 args='offset+length' encoding='' 0.62 % ±0.94% ±1.25% ±1.64%
buffers/buffer-write-string.js n=1000000 len=2048 args='offset+length' encoding='ascii' 0.11 % ±2.80% ±3.73% ±4.86%
buffers/buffer-write-string.js n=1000000 len=2048 args='offset+length' encoding='hex' -0.31 % ±0.54% ±0.72% ±0.94%
buffers/buffer-write-string.js n=1000000 len=2048 args='offset+length' encoding='latin1' *** 8.24 % ±3.35% ±4.46% ±5.81%
buffers/buffer-write-string.js n=1000000 len=2048 args='offset+length' encoding='utf16le' -0.35 % ±1.94% ±2.60% ±3.39%
buffers/buffer-write-string.js n=1000000 len=2048 args='offset+length' encoding='utf8' 0.97 % ±1.11% ±1.48% ±1.93%
buffers/buffer-write.js n=1000000 type='BigInt64BE' buffer='fast' 0.35 % ±1.94% ±2.58% ±3.36%
buffers/buffer-write.js n=1000000 type='BigInt64LE' buffer='fast' -1.34 % ±1.98% ±2.63% ±3.43%
buffers/buffer-write.js n=1000000 type='BigUInt64BE' buffer='fast' ** -2.64 % ±1.66% ±2.21% ±2.89%
buffers/buffer-write.js n=1000000 type='BigUInt64LE' buffer='fast' 1.65 % ±1.72% ±2.29% ±2.98%
buffers/buffer-write.js n=1000000 type='DoubleBE' buffer='fast' 2.25 % ±14.95% ±19.89% ±25.89%
buffers/buffer-write.js n=1000000 type='DoubleLE' buffer='fast' 1.41 % ±14.99% ±19.95% ±25.96%
buffers/buffer-write.js n=1000000 type='FloatBE' buffer='fast' 1.01 % ±16.07% ±21.38% ±27.83%
buffers/buffer-write.js n=1000000 type='FloatLE' buffer='fast' -8.07 % ±15.13% ±20.13% ±26.20%
buffers/buffer-write.js n=1000000 type='Int16BE' buffer='fast' -6.06 % ±13.96% ±18.58% ±24.18%
buffers/buffer-write.js n=1000000 type='Int16LE' buffer='fast' -2.89 % ±14.23% ±18.93% ±24.64%
buffers/buffer-write.js n=1000000 type='Int32BE' buffer='fast' -9.14 % ±15.02% ±20.01% ±26.08%
buffers/buffer-write.js n=1000000 type='Int32LE' buffer='fast' 9.94 % ±18.60% ±24.76% ±32.23%
buffers/buffer-write.js n=1000000 type='Int8' buffer='fast' -3.43 % ±12.10% ±16.11% ±20.96%
buffers/buffer-write.js n=1000000 type='IntBE' buffer='fast' -5.34 % ±9.07% ±12.07% ±15.71%
buffers/buffer-write.js n=1000000 type='IntLE' buffer='fast' 7.27 % ±10.16% ±13.52% ±17.60%
buffers/buffer-write.js n=1000000 type='UInt16BE' buffer='fast' -2.96 % ±13.91% ±18.51% ±24.09%
buffers/buffer-write.js n=1000000 type='UInt16LE' buffer='fast' * 19.15 % ±16.02% ±21.34% ±27.82%
buffers/buffer-write.js n=1000000 type='UInt32BE' buffer='fast' 7.51 % ±9.55% ±12.71% ±16.54%
buffers/buffer-write.js n=1000000 type='UInt32LE' buffer='fast' 4.99 % ±11.06% ±14.72% ±19.16%
buffers/buffer-write.js n=1000000 type='UInt8' buffer='fast' 0.04 % ±14.91% ±19.84% ±25.82%
buffers/buffer-write.js n=1000000 type='UIntBE' buffer='fast' 2.04 % ±13.56% ±18.04% ±23.48%
buffers/buffer-write.js n=1000000 type='UIntLE' buffer='fast' -1.58 % ±11.92% ±15.86% ±20.64%
buffers/buffer-zero.js type='buffer' n=1000000 -1.00 % ±2.07% ±2.76% ±3.59%
buffers/buffer-zero.js type='string' n=1000000 * 4.44 % ±3.80% ±5.08% ±6.65%
buffers/dataview-set.js n=1000000 type='Float32BE' 0.44 % ±6.80% ±9.05% ±11.78%
buffers/dataview-set.js n=1000000 type='Float32LE' -0.97 % ±5.11% ±6.80% ±8.86%
buffers/dataview-set.js n=1000000 type='Float64BE' -1.46 % ±7.21% ±9.60% ±12.49%
buffers/dataview-set.js n=1000000 type='Float64LE' 0.31 % ±5.99% ±7.97% ±10.38%
buffers/dataview-set.js n=1000000 type='Int16BE' 0.78 % ±3.22% ±4.29% ±5.59%
buffers/dataview-set.js n=1000000 type='Int16LE' 0.13 % ±4.58% ±6.09% ±7.93%
buffers/dataview-set.js n=1000000 type='Int32BE' 1.32 % ±3.89% ±5.18% ±6.75%
buffers/dataview-set.js n=1000000 type='Int32LE' 0.37 % ±2.74% ±3.65% ±4.75%
buffers/dataview-set.js n=1000000 type='Int8' * -2.28 % ±2.12% ±2.83% ±3.69%
buffers/dataview-set.js n=1000000 type='Uint16BE' 1.02 % ±3.25% ±4.32% ±5.62%
buffers/dataview-set.js n=1000000 type='Uint16LE' -3.22 % ±4.22% ±5.62% ±7.32%
buffers/dataview-set.js n=1000000 type='Uint32BE' -1.53 % ±1.99% ±2.66% ±3.48%
buffers/dataview-set.js n=1000000 type='Uint32LE' -3.02 % ±3.13% ±4.17% ±5.44%
buffers/dataview-set.js n=1000000 type='Uint8' 0.61 % ±1.77% ±2.35% ±3.06%
|
Sorry, something went wrong.
|
Let's hold off until we figure out what's going on @ronag Which benchmark is that in the PR description? If it's not in tree, could you add it (or modify buffer-copy.js) to test behavior on:
All of those are important / could give different results This should be tested with benchmarks code Also the bech should have 64/128 bytes in sizes (along others lower/higher) as there is a sharp difference there in how the data is stored in some cases. |
Sorry, something went wrong.
|
Also i'm curious why is v8 slower on SAB there |
Sorry, something went wrong.
Because the javascript memory model is super strict. |
Sorry, something went wrong.
|
ChatGPT:
|
Sorry, something went wrong.
|
So from what I understand on ARM the implementation is not allowed to use SIMD since it invalidated the "no-tear" requirement of the memory model, while on x86 this is not a problem. I think we maybe should document that Buffer.copy (and in general all buffer operations that we implement) do not strictly follow the ecmascript memory model guarantees. @mcollina |
Sorry, something went wrong.
AFAIA it's that V8 uses a libatomic-based memmove implementation if the source or target is SAB-backed. |
Sorry, something went wrong.
|
Huh, we likely have another bug in _copy Details Doc: https://nodejs.org/api/buffer.html#bufcopytarget-targetstart-sourcestart-sourceend > Copies data from a region of buf to a region in target, even if the target memory region overlaps with buf.It should be using memove, not memcpy then Those are different under some libs/optimizations E.g.: I have not verified that the issue exists yet, but given the overall lack of bound checks in _copy it needs a recheck Upd: No, _copy uses memmove, not memcpy.
This is hallucinated, _copy doesn't use memcpy. |
Sorry, something went wrong.
How often are Buffer.from(SAB) used and where? |
Sorry, something went wrong.
When it's used it's super important. It's the only way to efficiently use workers in node. Also implementing that guarantee needs us to update most buffer operations which will make things harder to maintain, e.g. rewriting Buffer.write to adhere to the strict memory model is not a trivial task. IMHO it's better to have the current more relaxed memory model for node buffers and document it. and TBH it doesn't make any difference for this PR since sometimes the implementation uses set and sometimes _copy which make the whole situation even more confusing. |
Sorry, something went wrong.
It's talking about typedarray.set, not _copy. |
Sorry, something went wrong.
|
@ChALkeR I do see you have good intentions here and you are probably right. But this is becoming to much work for what I feel is a rather straightforward change. We run x86 in production which is not affected by this so I can't motivate spending much more time on this. Please feel free to take over this PR or open a different one. I'm happy to continue discussing but getting this over the finish line seems like a too big task for me at the moment. IMHO I would recommend to land this is as revert of a change causing a perf regression and then start over with 2 different PR's in regards to the memory model and the performance (set is faster in certain scenarios) topics. |
Sorry, something went wrong.
|
I think @jasnell might have some insightful opinions in regards to the difference between memory models of Buffer and TypedArray, i.e. Buffer is much more relaxed (context is in regards to SharedArrayBuffer as the backing store). |
Sorry, something went wrong.
Yes, it's talking about typedarray.set vs memcpy, and the bottom part of that is not relevant as this is PR is really typedarray.set vs _copy which is memmove (not memcpy), so memcpy overlapping concerns (the cited part) do not apply to this PR. So that's not the answer.
Perf regression under which usecase?
Also it's not demonstrated. |
Sorry, something went wrong.
If this is about Buffer.from(new SharedArrayBuffer, there is only a single lib over 10k downloads/month that appears to have that literal string: 157837 @pnpm:tarball-fetcher-1003.0.0.tgz/lib/remoteTarballFetcher.js:130: data = Buffer.from(new SharedArrayBuffer(downloaded)); There might be more non-literal matches, but this hints at low usage anyway. What exactly is affected that justifies regressing .copy perf for everything else? note: this perf question is orthogonal to the concern that using _copy on SAB might give wrong results, that is smth we should check separately from this PR as this is not the PR that introduces that, it might be wrong in main |
Sorry, something went wrong.
There was a problem hiding this comment.
I don't think we should land perf-only PRs without benchmarks that demonstrate the improvement
So far, existing benchmarks demonstrate only slowdown
Even if this is landed (in the current form), it is likely to be flipped back in another attempt to optimize under the guidance of maintained benchmarks
Separately, when benchmarks are introduced, we should consider if that's a usecase that is likely to happen / under what conditions (and if that is worth a slowdown on other common usecases). I don't say that this doesn't have usage, but so far it's unclear from the current PR.
Sorry, something went wrong.
import { bench, run, group, summary } from 'mitata'
const SIZES = [64, 256, 1024, 4096, 16_384, 65_536, 256_000, 1024_000]
for (const size of SIZES) {
const src = Buffer.alloc(size, 0x42)
const abDst = Buffer.from(new ArrayBuffer(size))
const sabDst = Buffer.from(new SharedArrayBuffer(size))
summary(() => {
group(`Buffer.copy ${size} bytes`, () => {
bench(`ArrayBuffer (${size})`, () => {
src.copy(abDst)
})
bench(`SharedArrayBuffer (${size})`, () => {
src.copy(sabDst)
})
})
})
}
await run()clk: ~3.68 GHz cpu: Apple M3 Pro runtime: node 25.6.1 (arm64-darwin) Size ArrayBuffer SharedArrayBuffer Slowdown AB IPC SAB IPC ────── ─────────── ───────────────── ──────── ────── ─────── 64 B 10.65 ns 12.47 ns 1.17x 7.40 6.60 256 B 12.43 ns 20.72 ns 1.67x 7.00 5.86 1 KiB 19.76 ns 51.77 ns 2.62x 6.50 4.80 4 KiB 57.98 ns 163.05 ns 2.81x 4.95 4.79 16 KiB 235.94 ns 602.94 ns 2.56x 3.95 4.88 64 KiB 645.66 ns 2.31 µs 3.58x 5.39 4.93 256 KiB 3.30 µs 8.96 µs 2.72x 4.05 4.93 1 MiB 13.13 µs 37.43 µs 2.85x 4.06 4.91 |
Sorry, something went wrong.
|
@RafaelGSS maybe you can assists with measuring + benchmarks on this to possibly unblock the PR? |
Sorry, something went wrong.
|
Thanks for the benchmark! I think it was a mistake to compare only relative SAB/AB perf, not absolute with/without patch. According to that bench (modified to not use a dep), comparing 24.11.0 to 24.12.0 (which introduced that change in the first place), I expect that this PR is a slowdown for both SAB and ArrayBuffer on sizes <= 256 (or slightly larger) It makes AB and SAB values approximately equal there, so the coef is brought to ~1x, but it just makes them equally slow. For sizes 1k-16k, according to that provided benchmark, this significantly slows down regular Buffer but significantly improves SAB. For sizes >=65k this has almost no effect on regular Buffer but significantly improves SAB. This hints at a better fix - not plain revert (that makes AB worse and even SAB worse on small buffers), not SAB detection, but a mix of SAB + size detection. 24.12.0 (with #60399): ArrayBuffer (64) x 55,944,332 ops/sec @ 17ns/op (0ns..62μs) SharedArrayBuffer (64) x 54,226,486 ops/sec @ 18ns/op (0ns..40μs) ArrayBuffer (256) x 53,484,271 ops/sec @ 18ns/op (0ns..50μs) SharedArrayBuffer (256) x 43,170,692 ops/sec @ 23ns/op (0ns..45μs) ArrayBuffer (1024) x 39,508,050 ops/sec @ 25ns/op (0ns..81μs) SharedArrayBuffer (1024) x 18,266,498 ops/sec @ 54ns/op (0ns..598μs) ArrayBuffer (4096) x 16,610,492 ops/sec @ 60ns/op (0ns..167μs) SharedArrayBuffer (4096) x 6,111,767 ops/sec @ 163ns/op (83ns..284μs) ArrayBuffer (16384) x 4,518,893 ops/sec @ 221ns/op (83ns..33μs) SharedArrayBuffer (16384) x 1,724,397 ops/sec @ 579ns/op (458ns..3ms) ArrayBuffer (65536) x 1,072,019 ops/sec @ 932ns/op (666ns..1062μs) SharedArrayBuffer (65536) x 450,827 ops/sec @ 2μs/op (2μs..138μs) ArrayBuffer (256000) x 266,026 ops/sec @ 3μs/op (3μs..79μs) SharedArrayBuffer (256000) x 115,247 ops/sec @ 8μs/op (8μs..162μs) ArrayBuffer (1024000) x 66,486 ops/sec @ 15μs/op (14μs..284μs) SharedArrayBuffer (1024000) x 29,303 ops/sec @ 34μs/op (33μs..122μs) 24.11.0 (likely where with this revert would bring us): ArrayBuffer (64) x 35,945,832 ops/sec @ 27ns/op (0ns..66μs) SharedArrayBuffer (64) x 35,986,388 ops/sec @ 27ns/op (0ns..105μs) ArrayBuffer (256) x 31,984,815 ops/sec @ 31ns/op (0ns..83μs) SharedArrayBuffer (256) x 31,965,087 ops/sec @ 31ns/op (0ns..49μs) ArrayBuffer (1024) x 25,381,144 ops/sec @ 39ns/op (0ns..33μs) SharedArrayBuffer (1024) x 25,602,860 ops/sec @ 39ns/op (0ns..46μs) ArrayBuffer (4096) x 13,687,190 ops/sec @ 73ns/op (0ns..41μs) SharedArrayBuffer (4096) x 13,724,997 ops/sec @ 72ns/op (0ns..36μs) ArrayBuffer (16384) x 4,195,405 ops/sec @ 238ns/op (125ns..54μs) SharedArrayBuffer (16384) x 4,176,256 ops/sec @ 239ns/op (84ns..35μs) ArrayBuffer (65536) x 1,100,011 ops/sec @ 909ns/op (625ns..47μs) SharedArrayBuffer (65536) x 1,058,282 ops/sec @ 944ns/op (708ns..25μs) ArrayBuffer (256000) x 267,497 ops/sec @ 3μs/op (3μs..55μs) SharedArrayBuffer (256000) x 267,308 ops/sec @ 3μs/op (3μs..37μs) ArrayBuffer (1024000) x 66,538 ops/sec @ 15μs/op (14μs..147μs) SharedArrayBuffer (1024000) x 66,529 ops/sec @ 15μs/op (14μs..94μs) That said, I have not tested applying this to main yet. |
Sorry, something went wrong.
There was a problem hiding this comment.
I re-tested this PR and compared it to base branch without it
In short: this PR description mentions sizes 256 and 4096 with relative "slowdown" on SAB compared to AB, and claims to improve that relative slowdown.
What is does instead is makes both AB and SAB slower on size=256. Down to an identical value though.
It has benefits for on higher lengths though, for Buffer.from(new SharedArrayBuffer( only.
But it also still hurts regular Buffer instances up to ~16k, and Buffer.from(new SharedArrayBuffer( is very rare to justify noticeable slowdown on regular Buffer.
This needs not just benchmarks, but the implementation fixed to not cause a perf regression.
BaseArrayBuffer (64) x 54,529,149 ops/sec @ 18ns/op (0ns..305μs) SharedArrayBuffer (64) x 53,716,573 ops/sec @ 18ns/op (0ns..38μs) ArrayBuffer (256) x 52,328,394 ops/sec @ 19ns/op (0ns..41μs) SharedArrayBuffer (256) x 41,411,669 ops/sec @ 24ns/op (0ns..42μs) ArrayBuffer (1024) x 38,529,150 ops/sec @ 25ns/op (0ns..36μs) SharedArrayBuffer (1024) x 18,232,579 ops/sec @ 54ns/op (0ns..41μs) ArrayBuffer (4096) x 16,600,224 ops/sec @ 60ns/op (0ns..40μs) SharedArrayBuffer (4096) x 6,146,755 ops/sec @ 162ns/op (42ns..59μs) ArrayBuffer (16384) x 3,042,573 ops/sec @ 328ns/op (83ns..72μs) SharedArrayBuffer (16384) x 1,741,612 ops/sec @ 574ns/op (458ns..45μs) ArrayBuffer (65536) x 1,053,112 ops/sec @ 949ns/op (666ns..70μs) SharedArrayBuffer (65536) x 451,151 ops/sec @ 2μs/op (2μs..60μs) ArrayBuffer (256000) x 251,257 ops/sec @ 3μs/op (3μs..10ms) SharedArrayBuffer (256000) x 116,322 ops/sec @ 8μs/op (8μs..80μs) ArrayBuffer (1024000) x 66,171 ops/sec @ 15μs/op (14μs..206μs) SharedArrayBuffer (1024000) x 29,225 ops/sec @ 34μs/op (33μs..135μs)
ArrayBuffer (64) x 40,335,525 ops/sec @ 24ns/op (0ns..46μs) SharedArrayBuffer (64) x 39,725,116 ops/sec @ 25ns/op (0ns..80μs) ArrayBuffer (256) x 35,785,083 ops/sec @ 27ns/op (0ns..45μs) SharedArrayBuffer (256) x 35,819,652 ops/sec @ 27ns/op (0ns..39μs) ArrayBuffer (1024) x 27,800,955 ops/sec @ 35ns/op (0ns..41μs) SharedArrayBuffer (1024) x 27,316,682 ops/sec @ 36ns/op (0ns..57μs) ArrayBuffer (4096) x 14,335,737 ops/sec @ 69ns/op (0ns..35μs) SharedArrayBuffer (4096) x 14,335,732 ops/sec @ 69ns/op (0ns..84μs) ArrayBuffer (16384) x 3,025,528 ops/sec @ 330ns/op (84ns..43μs) SharedArrayBuffer (16384) x 2,995,333 ops/sec @ 333ns/op (125ns..36μs) ArrayBuffer (65536) x 1,053,536 ops/sec @ 949ns/op (708ns..23μs) SharedArrayBuffer (65536) x 1,052,752 ops/sec @ 949ns/op (708ns..67μs) ArrayBuffer (256000) x 265,626 ops/sec @ 3μs/op (3μs..62μs) SharedArrayBuffer (256000) x 266,723 ops/sec @ 3μs/op (3μs..55μs) ArrayBuffer (1024000) x 66,146 ops/sec @ 15μs/op (14μs..170μs) SharedArrayBuffer (1024000) x 66,000 ops/sec @ 15μs/op (14μs..102μs)
Sorry, something went wrong.
If someone wants to do that go ahead. I still think this PR is better than the current state of things, i.e. both have acceptable performance while the current state of things is AB with great performance and SAB with horrible performance. If you look at the numbers the AB regression you mention is 6ns (?) while the SAB regression I want to fix is 1000+ ns (?). Also we should document that difference in the memory model for Buffer vs TypedArray, if no-one else feels comfortable doing that I will try to make time for that at some point. |
Sorry, something went wrong.
|
Digging into Relaxed_Memcpy I don't see how it would be different from a normal memcpy on any mainstream architecture. Possibly this is simply not an optimized path where strict spec conformance is prioritized. |
Sorry, something went wrong.
|
cc @nodejs/v8 |
Sorry, something went wrong.
First, not only AB regression but both AB and SAB regression here up for length at least up to 256 Second, you seem to be comparing Buffer.alloc(64) to Buffer.from(new SharedArrayBuffer(64 * 1024)) for those 6ns vs 1000ns numbers? The relative perf is what matters more here, not absolute difference across sizes that are 3 orders of magnitude apart. Small copies are more frequent and can accumulate to higher values. Third, see the usecase concern. This trades 1.0x-1.4x (depending on size) perf on copying Buffer.alloc() / Buffer.from() for 0.7x - 2.3x (depending on size) perf on copying Buffer.from(new SharedArrayBuffer()). This PR does demonstrate that there is smth with SAB going on on higher lengths, but it needs someone to fix this and should not land as-is. I.e. agree on "If someone wants to do that go ahead" and this is likely fixable into an actual improvement, disagree on "I still think this PR is better than the current state of things", for making vastly most common case significantly worse and the usecase concern. |
Sorry, something went wrong.
|
Should likely be converted into an issue with the findings |
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
This fixes a performance regression for Buffer.copy(target, 0) and brings it back inline with Buffer.write.
V8 has a massive TypedArray.prototype.set penalty on SharedArrayBuffer
Buffer.set and Buffer.copy are up to 8.4x slower when writing to a SharedArrayBuffer vs a regular ArrayBuffer, while Buffer.write (string encoding) is completely unaffected.
256 bytes, varying offset (Apple M3 Pro, Node 25.6.1): ArrayBuffer SharedArrayBuffer Slowdown Buffer.set 13.6 ns 56.1 ns 4.1x Buffer.copy 17.0 ns 65.1 ns 3.8x Buffer.write 75.8 ns 74.1 ns 1.0x (unaffected) 4096 bytes, varying offset: ArrayBuffer SharedArrayBuffer Slowdown Buffer.set 80.3 ns 674.2 ns 8.4x Buffer.copy 78.4 ns 677.7 ns 8.6x Buffer.write 190.6 ns 186.1 ns 1.0x (unaffected)