Skip to content

Conversation

@LiviaMedeiros
Copy link
Member

Follow-up from #60796

In http2 and zlib, fn.call(...) is preferable over FunctionPrototypeCall(fn, ...) according to:

For some area of the codebase, performance and code readability are deemed more
important than reliability against prototype pollution:
* `node:http`
* `node:http2`
* `node:tls`
* `node:zlib`

Local benchmark shows about +5% performance in zlib/creation and about +3-4% in deflateSync and inflateSync

                                                                                                        confidence improvement accuracy (*)    (**)   (***)
http2/compat.js duration=5 benchmarker='test-double-http2' clients=2 streams=1 requests=100                      *     -2.59 %       ±2.41%  ±3.20%  ±4.18%
http2/compat.js duration=5 benchmarker='test-double-http2' clients=2 streams=1 requests=1000                           -0.12 %       ±2.07%  ±2.76%  ±3.59%
http2/compat.js duration=5 benchmarker='test-double-http2' clients=2 streams=1 requests=5000                           -0.11 %       ±2.04%  ±2.71%  ±3.53%
http2/compat.js duration=5 benchmarker='test-double-http2' clients=2 streams=10 requests=100                            0.58 %       ±2.59%  ±3.45%  ±4.50%
http2/compat.js duration=5 benchmarker='test-double-http2' clients=2 streams=10 requests=1000                          -2.23 %       ±2.47%  ±3.29%  ±4.28%
http2/compat.js duration=5 benchmarker='test-double-http2' clients=2 streams=10 requests=5000                          -1.42 %       ±2.57%  ±3.42%  ±4.46%
http2/compat.js duration=5 benchmarker='test-double-http2' clients=2 streams=100 requests=100                           0.49 %       ±1.92%  ±2.56%  ±3.34%
http2/compat.js duration=5 benchmarker='test-double-http2' clients=2 streams=100 requests=1000                          1.07 %       ±2.23%  ±2.96%  ±3.86%
http2/compat.js duration=5 benchmarker='test-double-http2' clients=2 streams=100 requests=5000                          1.31 %       ±2.33%  ±3.10%  ±4.04%
http2/compat.js duration=5 benchmarker='test-double-http2' clients=2 streams=20 requests=100                            0.63 %       ±2.15%  ±2.86%  ±3.73%
http2/compat.js duration=5 benchmarker='test-double-http2' clients=2 streams=20 requests=1000                           0.36 %       ±2.16%  ±2.88%  ±3.75%
http2/compat.js duration=5 benchmarker='test-double-http2' clients=2 streams=20 requests=5000                           0.71 %       ±2.27%  ±3.02%  ±3.94%
http2/compat.js duration=5 benchmarker='test-double-http2' clients=2 streams=200 requests=100                           0.65 %       ±2.48%  ±3.30%  ±4.30%
http2/compat.js duration=5 benchmarker='test-double-http2' clients=2 streams=200 requests=1000                          0.69 %       ±2.72%  ±3.63%  ±4.72%
http2/compat.js duration=5 benchmarker='test-double-http2' clients=2 streams=200 requests=5000                          0.71 %       ±2.05%  ±2.73%  ±3.55%
http2/compat.js duration=5 benchmarker='test-double-http2' clients=2 streams=40 requests=100                            2.05 %       ±2.10%  ±2.79%  ±3.64%
http2/compat.js duration=5 benchmarker='test-double-http2' clients=2 streams=40 requests=1000                          -1.53 %       ±2.24%  ±2.98%  ±3.89%
http2/compat.js duration=5 benchmarker='test-double-http2' clients=2 streams=40 requests=5000                           1.05 %       ±2.20%  ±2.93%  ±3.82%
http2/headers.js nheaders=0 n=1000                                                                               *      1.24 %       ±1.03%  ±1.36%  ±1.78%
http2/headers.js nheaders=10 n=1000                                                                                     0.08 %       ±1.02%  ±1.36%  ±1.77%
http2/headers.js nheaders=100 n=1000                                                                                    0.39 %       ±0.87%  ±1.16%  ±1.51%
http2/headers.js nheaders=1000 n=1000                                                                                   0.54 %       ±0.80%  ±1.07%  ±1.40%
http2/respond-with-fd.js duration=5 benchmarker='test-double-http2' clients=2 streams=1 requests=100            **      5.16 %       ±3.53%  ±4.70%  ±6.12%
http2/respond-with-fd.js duration=5 benchmarker='test-double-http2' clients=2 streams=1 requests=1000                  -1.27 %       ±4.34%  ±5.78%  ±7.52%
http2/respond-with-fd.js duration=5 benchmarker='test-double-http2' clients=2 streams=1 requests=5000                   2.88 %       ±4.02%  ±5.35%  ±6.97%
http2/respond-with-fd.js duration=5 benchmarker='test-double-http2' clients=2 streams=10 requests=100                  -0.13 %       ±3.78%  ±5.04%  ±6.56%
http2/respond-with-fd.js duration=5 benchmarker='test-double-http2' clients=2 streams=10 requests=1000                  1.86 %       ±3.81%  ±5.08%  ±6.62%
http2/respond-with-fd.js duration=5 benchmarker='test-double-http2' clients=2 streams=10 requests=5000                 -1.39 %       ±3.64%  ±4.84%  ±6.30%
http2/respond-with-fd.js duration=5 benchmarker='test-double-http2' clients=2 streams=100 requests=100                  1.74 %       ±3.83%  ±5.10%  ±6.64%
http2/respond-with-fd.js duration=5 benchmarker='test-double-http2' clients=2 streams=100 requests=1000                -1.61 %       ±4.33%  ±5.76%  ±7.50%
http2/respond-with-fd.js duration=5 benchmarker='test-double-http2' clients=2 streams=100 requests=5000                 0.63 %       ±4.14%  ±5.51%  ±7.18%
http2/respond-with-fd.js duration=5 benchmarker='test-double-http2' clients=2 streams=20 requests=100                   0.29 %       ±3.71%  ±4.94%  ±6.43%
http2/respond-with-fd.js duration=5 benchmarker='test-double-http2' clients=2 streams=20 requests=1000                 -0.70 %       ±4.28%  ±5.70%  ±7.43%
http2/respond-with-fd.js duration=5 benchmarker='test-double-http2' clients=2 streams=20 requests=5000                 -1.56 %       ±3.89%  ±5.18%  ±6.74%
http2/respond-with-fd.js duration=5 benchmarker='test-double-http2' clients=2 streams=200 requests=100                  0.07 %       ±4.05%  ±5.39%  ±7.02%
http2/respond-with-fd.js duration=5 benchmarker='test-double-http2' clients=2 streams=200 requests=1000                -1.21 %       ±3.62%  ±4.82%  ±6.30%
http2/respond-with-fd.js duration=5 benchmarker='test-double-http2' clients=2 streams=200 requests=5000                -2.92 %       ±3.62%  ±4.82%  ±6.29%
http2/respond-with-fd.js duration=5 benchmarker='test-double-http2' clients=2 streams=40 requests=100                   1.37 %       ±4.08%  ±5.43%  ±7.07%
http2/respond-with-fd.js duration=5 benchmarker='test-double-http2' clients=2 streams=40 requests=1000                  3.15 %       ±3.55%  ±4.72%  ±6.15%
http2/respond-with-fd.js duration=5 benchmarker='test-double-http2' clients=2 streams=40 requests=5000                  1.35 %       ±3.86%  ±5.13%  ±6.68%
http2/simple.js duration=5 benchmarker='test-double-http2' clients=2 streams=1 requests=100                            -2.66 %       ±2.78%  ±3.69%  ±4.81%
http2/simple.js duration=5 benchmarker='test-double-http2' clients=2 streams=1 requests=1000                           -0.44 %       ±3.69%  ±4.91%  ±6.39%
http2/simple.js duration=5 benchmarker='test-double-http2' clients=2 streams=1 requests=5000                            0.66 %       ±2.68%  ±3.57%  ±4.65%
http2/simple.js duration=5 benchmarker='test-double-http2' clients=2 streams=10 requests=100                            1.45 %       ±2.68%  ±3.57%  ±4.65%
http2/simple.js duration=5 benchmarker='test-double-http2' clients=2 streams=10 requests=1000                          -1.87 %       ±2.41%  ±3.21%  ±4.18%
http2/simple.js duration=5 benchmarker='test-double-http2' clients=2 streams=10 requests=5000                          -0.36 %       ±2.77%  ±3.68%  ±4.80%
http2/simple.js duration=5 benchmarker='test-double-http2' clients=2 streams=100 requests=100                           0.66 %       ±3.39%  ±4.51%  ±5.87%
http2/simple.js duration=5 benchmarker='test-double-http2' clients=2 streams=100 requests=1000                         -0.99 %       ±2.70%  ±3.59%  ±4.67%
http2/simple.js duration=5 benchmarker='test-double-http2' clients=2 streams=100 requests=5000                          0.98 %       ±2.62%  ±3.49%  ±4.54%
http2/simple.js duration=5 benchmarker='test-double-http2' clients=2 streams=20 requests=100                            0.01 %       ±2.93%  ±3.90%  ±5.08%
http2/simple.js duration=5 benchmarker='test-double-http2' clients=2 streams=20 requests=1000                           1.33 %       ±2.98%  ±3.97%  ±5.16%
http2/simple.js duration=5 benchmarker='test-double-http2' clients=2 streams=20 requests=5000                           0.20 %       ±2.63%  ±3.50%  ±4.55%
http2/simple.js duration=5 benchmarker='test-double-http2' clients=2 streams=200 requests=100                           1.07 %       ±2.71%  ±3.60%  ±4.69%
http2/simple.js duration=5 benchmarker='test-double-http2' clients=2 streams=200 requests=1000                         -0.00 %       ±3.01%  ±4.01%  ±5.23%
http2/simple.js duration=5 benchmarker='test-double-http2' clients=2 streams=200 requests=5000                          0.88 %       ±2.68%  ±3.56%  ±4.64%
http2/simple.js duration=5 benchmarker='test-double-http2' clients=2 streams=40 requests=100                            1.44 %       ±3.08%  ±4.11%  ±5.36%
http2/simple.js duration=5 benchmarker='test-double-http2' clients=2 streams=40 requests=1000                          -2.14 %       ±2.46%  ±3.27%  ±4.26%
http2/simple.js duration=5 benchmarker='test-double-http2' clients=2 streams=40 requests=5000                           1.06 %       ±3.07%  ±4.09%  ±5.35%
http2/write.js duration=5 benchmarker='test-double-http2' size=100000 length=1048576 streams=100                       -0.21 %       ±1.41%  ±1.87%  ±2.44%
http2/write.js duration=5 benchmarker='test-double-http2' size=100000 length=1048576 streams=1000                       0.37 %       ±1.39%  ±1.84%  ±2.40%
http2/write.js duration=5 benchmarker='test-double-http2' size=100000 length=1048576 streams=200                       -0.34 %       ±1.18%  ±1.56%  ±2.04%
http2/write.js duration=5 benchmarker='test-double-http2' size=100000 length=131072 streams=100                         0.48 %       ±2.07%  ±2.76%  ±3.60%
http2/write.js duration=5 benchmarker='test-double-http2' size=100000 length=131072 streams=1000                        0.94 %       ±3.20%  ±4.25%  ±5.54%
http2/write.js duration=5 benchmarker='test-double-http2' size=100000 length=131072 streams=200                         1.02 %       ±2.81%  ±3.74%  ±4.87%
http2/write.js duration=5 benchmarker='test-double-http2' size=100000 length=262144 streams=100                         0.24 %       ±1.60%  ±2.13%  ±2.78%
http2/write.js duration=5 benchmarker='test-double-http2' size=100000 length=262144 streams=1000                       -0.62 %       ±1.44%  ±1.91%  ±2.49%
http2/write.js duration=5 benchmarker='test-double-http2' size=100000 length=262144 streams=200                         0.61 %       ±1.68%  ±2.24%  ±2.93%
http2/write.js duration=5 benchmarker='test-double-http2' size=100000 length=65536 streams=100                          0.34 %       ±0.82%  ±1.10%  ±1.44%
http2/write.js duration=5 benchmarker='test-double-http2' size=100000 length=65536 streams=1000                        -0.18 %       ±0.93%  ±1.24%  ±1.62%
http2/write.js duration=5 benchmarker='test-double-http2' size=100000 length=65536 streams=200                          0.82 %       ±1.20%  ±1.60%  ±2.08%
zlib/crc32.js n=4000000 len=256 type='buffer'                                                                           0.47 %       ±0.83%  ±1.10%  ±1.43%
zlib/crc32.js n=4000000 len=256 type='string'                                                                           0.13 %       ±0.58%  ±0.77%  ±1.00%
zlib/crc32.js n=4000000 len=32 type='buffer'                                                                           -0.22 %       ±0.75%  ±0.99%  ±1.29%
zlib/crc32.js n=4000000 len=32 type='string'                                                                           -0.05 %       ±0.66%  ±0.88%  ±1.14%
zlib/crc32.js n=4000000 len=4096 type='buffer'                                                                         -0.56 %       ±0.80%  ±1.07%  ±1.40%
zlib/crc32.js n=4000000 len=4096 type='string'                                                                         -0.31 %       ±0.67%  ±0.89%  ±1.15%
zlib/crc32.js n=4000000 len=65536 type='buffer'                                                                        -0.72 %       ±0.73%  ±0.97%  ±1.27%
zlib/crc32.js n=4000000 len=65536 type='string'                                                                         0.19 %       ±0.80%  ±1.07%  ±1.39%
zlib/createInflate.js n=100 chunkLen=1024 inputLen=16777216                                                            -3.20 %       ±4.95%  ±6.59%  ±8.59%
zlib/creation.js n=500000 options='false' type='BrotliCompress'                                                ***      4.30 %       ±2.29%  ±3.05%  ±3.97%
zlib/creation.js n=500000 options='false' type='BrotliDecompress'                                              ***      5.34 %       ±2.11%  ±2.81%  ±3.67%
zlib/creation.js n=500000 options='false' type='Deflate'                                                        **      4.83 %       ±2.82%  ±3.76%  ±4.89%
zlib/creation.js n=500000 options='false' type='DeflateRaw'                                                    ***      6.19 %       ±2.73%  ±3.64%  ±4.74%
zlib/creation.js n=500000 options='false' type='Gunzip'                                                         **      3.70 %       ±2.59%  ±3.45%  ±4.49%
zlib/creation.js n=500000 options='false' type='Gzip'                                                          ***      6.44 %       ±3.37%  ±4.49%  ±5.86%
zlib/creation.js n=500000 options='false' type='Inflate'                                                       ***      5.87 %       ±2.49%  ±3.31%  ±4.31%
zlib/creation.js n=500000 options='false' type='InflateRaw'                                                    ***      4.81 %       ±2.47%  ±3.30%  ±4.30%
zlib/creation.js n=500000 options='false' type='Unzip'                                                         ***      7.42 %       ±2.83%  ±3.77%  ±4.90%
zlib/creation.js n=500000 options='false' type='ZstdCompress'                                                          -0.21 %       ±1.83%  ±2.44%  ±3.18%
zlib/creation.js n=500000 options='false' type='ZstdDecompress'                                                        -1.24 %       ±2.83%  ±3.77%  ±4.90%
zlib/creation.js n=500000 options='true' type='BrotliCompress'                                                 ***      4.90 %       ±2.27%  ±3.02%  ±3.93%
zlib/creation.js n=500000 options='true' type='BrotliDecompress'                                               ***      5.66 %       ±2.27%  ±3.02%  ±3.93%
zlib/creation.js n=500000 options='true' type='Deflate'                                                        ***      5.32 %       ±2.47%  ±3.28%  ±4.28%
zlib/creation.js n=500000 options='true' type='DeflateRaw'                                                     ***      5.71 %       ±2.51%  ±3.36%  ±4.40%
zlib/creation.js n=500000 options='true' type='Gunzip'                                                         ***      6.08 %       ±2.81%  ±3.74%  ±4.88%
zlib/creation.js n=500000 options='true' type='Gzip'                                                           ***      4.87 %       ±2.63%  ±3.50%  ±4.56%
zlib/creation.js n=500000 options='true' type='Inflate'                                                        ***      4.49 %       ±2.44%  ±3.26%  ±4.26%
zlib/creation.js n=500000 options='true' type='InflateRaw'                                                     ***      7.47 %       ±2.29%  ±3.05%  ±3.97%
zlib/creation.js n=500000 options='true' type='Unzip'                                                           **      3.97 %       ±2.59%  ±3.45%  ±4.49%
zlib/creation.js n=500000 options='true' type='ZstdCompress'                                                           -0.51 %       ±1.95%  ±2.59%  ±3.37%
zlib/creation.js n=500000 options='true' type='ZstdDecompress'                                                          1.30 %       ±2.66%  ±3.54%  ±4.61%
zlib/deflate.js n=400000 inputLen=1024 method='createDeflate'                                                         -10.55 %      ±12.56% ±16.79% ±22.00%
zlib/deflate.js n=400000 inputLen=1024 method='deflate'                                                                 2.23 %       ±3.61%  ±4.80%  ±6.26%
zlib/deflate.js n=400000 inputLen=1024 method='deflateSync'                                                    ***      3.21 %       ±0.72%  ±0.96%  ±1.25%
zlib/inflate.js n=400000 inputLen=1024 method='inflate'                                                                 6.46 %      ±17.81% ±23.71% ±30.89%
zlib/inflate.js n=400000 inputLen=1024 method='inflateSync'                                                    ***      4.22 %       ±1.64%  ±2.18%  ±2.84%
zlib/pipe.js algorithm='brotli' type='buffer' duration=5 inputLen=1024                                                  2.69 %       ±8.00% ±10.65% ±13.88%
zlib/pipe.js algorithm='brotli' type='string' duration=5 inputLen=1024                                                  4.14 %       ±7.30%  ±9.71% ±12.64%
zlib/pipe.js algorithm='gzip' type='buffer' duration=5 inputLen=1024                                                    1.27 %       ±1.99%  ±2.64%  ±3.44%
zlib/pipe.js algorithm='gzip' type='string' duration=5 inputLen=1024                                                    0.21 %       ±1.92%  ±2.56%  ±3.33%
zlib/pipe.js algorithm='zstd' type='buffer' duration=5 inputLen=1024                                                   -1.33 %       ±3.24%  ±4.32%  ±5.62%
zlib/pipe.js algorithm='zstd' type='string' duration=5 inputLen=1024                                                   -1.04 %       ±1.64%  ±2.19%  ±2.85%

Be aware that when doing many comparisons the risk of a false-positive result increases.
In this case, there are 112 comparisons, you can thus expect the following amount of false-positive results:
  5.60 false positives, when considering a   5% risk acceptance (*, **, ***),
  1.12 false positives, when considering a   1% risk acceptance (**, ***),
  0.11 false positives, when considering a 0.1% risk acceptance (***)

@LiviaMedeiros LiviaMedeiros added zlib Issues and PRs related to the zlib subsystem. http2 Issues or PRs related to the http2 subsystem. needs-ci PRs that need a full CI run. needs-benchmark-ci PR that need a benchmark CI run. labels Nov 24, 2025
@nodejs-github-bot
Copy link
Collaborator

Review requested:

  • @nodejs/http2
  • @nodejs/net

@codecov
Copy link

codecov bot commented Nov 24, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 88.54%. Comparing base (1758b74) to head (ffe3d11).
⚠️ Report is 22 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #60834      +/-   ##
==========================================
- Coverage   88.56%   88.54%   -0.03%     
==========================================
  Files         703      703              
  Lines      208268   208256      -12     
  Branches    40175    40166       -9     
==========================================
- Hits       184444   184390      -54     
- Misses      15828    15864      +36     
- Partials     7996     8002       +6     
Files with missing lines Coverage Δ
lib/internal/http2/compat.js 96.93% <100.00%> (-0.01%) ⬇️
lib/internal/http2/core.js 95.22% <100.00%> (-0.01%) ⬇️
lib/zlib.js 98.27% <100.00%> (-0.01%) ⬇️

... and 30 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@aduh95
Copy link
Contributor

aduh95 commented Nov 24, 2025

Can you try to benchmark with FunctionPrototypeCall?

@LiviaMedeiros
Copy link
Member Author

zlib/creation benchmarks using FunctionPrototypeCall::

                                                                  confidence improvement accuracy (*)   (**)  (***)
zlib/creation.js n=500000 options='false' type='BrotliCompress'                   0.12 %       ±1.11% ±1.47% ±1.92%
zlib/creation.js n=500000 options='false' type='BrotliDecompress'                 0.51 %       ±0.89% ±1.19% ±1.55%
zlib/creation.js n=500000 options='false' type='Deflate'                  **      1.57 %       ±1.14% ±1.52% ±1.97%
zlib/creation.js n=500000 options='false' type='DeflateRaw'                       0.82 %       ±1.11% ±1.47% ±1.92%
zlib/creation.js n=500000 options='false' type='Gunzip'                    *      1.36 %       ±1.16% ±1.54% ±2.00%
zlib/creation.js n=500000 options='false' type='Gzip'                             0.88 %       ±1.15% ±1.53% ±1.99%
zlib/creation.js n=500000 options='false' type='Inflate'                          0.63 %       ±1.27% ±1.69% ±2.20%
zlib/creation.js n=500000 options='false' type='InflateRaw'                       0.98 %       ±1.11% ±1.48% ±1.93%
zlib/creation.js n=500000 options='false' type='Unzip'                            0.18 %       ±0.98% ±1.31% ±1.70%
zlib/creation.js n=500000 options='false' type='ZstdCompress'             **      1.47 %       ±0.85% ±1.13% ±1.47%
zlib/creation.js n=500000 options='false' type='ZstdDecompress'           **     -1.75 %       ±1.28% ±1.71% ±2.22%
zlib/creation.js n=500000 options='true' type='BrotliCompress'                   -0.88 %       ±0.96% ±1.28% ±1.66%
zlib/creation.js n=500000 options='true' type='BrotliDecompress'                  0.06 %       ±0.86% ±1.14% ±1.49%
zlib/creation.js n=500000 options='true' type='Deflate'                   **      1.86 %       ±1.19% ±1.58% ±2.05%
zlib/creation.js n=500000 options='true' type='DeflateRaw'                        0.93 %       ±1.17% ±1.55% ±2.02%
zlib/creation.js n=500000 options='true' type='Gunzip'                            0.12 %       ±1.09% ±1.45% ±1.88%
zlib/creation.js n=500000 options='true' type='Gzip'                      **      1.87 %       ±1.26% ±1.68% ±2.18%
zlib/creation.js n=500000 options='true' type='Inflate'                          -0.11 %       ±1.13% ±1.50% ±1.95%
zlib/creation.js n=500000 options='true' type='InflateRaw'                        0.59 %       ±1.07% ±1.42% ±1.85%
zlib/creation.js n=500000 options='true' type='Unzip'                             0.16 %       ±1.09% ±1.45% ±1.89%
zlib/creation.js n=500000 options='true' type='ZstdCompress'                      0.56 %       ±1.01% ±1.34% ±1.74%
zlib/creation.js n=500000 options='true' type='ZstdDecompress'                   -0.67 %       ±1.20% ±1.59% ±2.08%

@aduh95
Copy link
Contributor

aduh95 commented Nov 24, 2025

zlib/creation benchmarks using FunctionPrototypeCall::

Comparing it against ReflectApply, not .call, correct? V8 optimising is definitely surprising, how come we get a worse perf on ZstdDecompress?!

@aduh95
Copy link
Contributor

aduh95 commented Nov 24, 2025

Benchmark CI: https://ci.nodejs.org/view/Node.js%20benchmark/job/benchmark-node-micro-benchmarks/1766/

                                                                       confidence improvement accuracy (*)    (**)   (***)
zlib/crc32.js n=4000000 len=256 type='buffer'                                          0.01 %       ±0.04%  ±0.06%  ±0.08%
zlib/crc32.js n=4000000 len=256 type='string'                                          0.20 %       ±0.27%  ±0.36%  ±0.48%
zlib/crc32.js n=4000000 len=32 type='buffer'                                           0.06 %       ±0.19%  ±0.25%  ±0.33%
zlib/crc32.js n=4000000 len=32 type='string'                                          -0.64 %       ±1.30%  ±1.76%  ±2.33%
zlib/crc32.js n=4000000 len=4096 type='buffer'                                        -0.05 %       ±0.07%  ±0.10%  ±0.13%
zlib/crc32.js n=4000000 len=4096 type='string'                                         0.01 %       ±0.13%  ±0.17%  ±0.22%
zlib/crc32.js n=4000000 len=65536 type='buffer'                               ***      0.08 %       ±0.02%  ±0.02%  ±0.03%
zlib/crc32.js n=4000000 len=65536 type='string'                                        0.07 %       ±0.15%  ±0.20%  ±0.26%
zlib/createInflate.js n=100 chunkLen=1024 inputLen=16777216                            1.99 %       ±2.16%  ±2.88%  ±3.75%
zlib/creation.js n=500000 options='false' type='BrotliCompress'               ***      4.17 %       ±0.71%  ±0.94%  ±1.22%
zlib/creation.js n=500000 options='false' type='BrotliDecompress'             ***      3.08 %       ±0.95%  ±1.26%  ±1.65%
zlib/creation.js n=500000 options='false' type='Deflate'                      ***      3.52 %       ±0.84%  ±1.11%  ±1.46%
zlib/creation.js n=500000 options='false' type='DeflateRaw'                   ***      3.13 %       ±0.73%  ±0.97%  ±1.27%
zlib/creation.js n=500000 options='false' type='Gunzip'                       ***      3.40 %       ±0.71%  ±0.94%  ±1.22%
zlib/creation.js n=500000 options='false' type='Gzip'                         ***      3.58 %       ±0.69%  ±0.92%  ±1.20%
zlib/creation.js n=500000 options='false' type='Inflate'                      ***      3.43 %       ±0.87%  ±1.16%  ±1.51%
zlib/creation.js n=500000 options='false' type='InflateRaw'                   ***      3.71 %       ±0.77%  ±1.02%  ±1.33%
zlib/creation.js n=500000 options='false' type='Unzip'                        ***      3.12 %       ±0.62%  ±0.83%  ±1.08%
zlib/creation.js n=500000 options='false' type='ZstdCompress'                          0.13 %       ±0.52%  ±0.69%  ±0.89%
zlib/creation.js n=500000 options='false' type='ZstdDecompress'                       -0.68 %       ±1.41%  ±1.88%  ±2.46%
zlib/creation.js n=500000 options='true' type='BrotliCompress'                ***      2.90 %       ±0.78%  ±1.04%  ±1.35%
zlib/creation.js n=500000 options='true' type='BrotliDecompress'              ***      3.33 %       ±1.04%  ±1.39%  ±1.81%
zlib/creation.js n=500000 options='true' type='Deflate'                       ***      3.25 %       ±0.99%  ±1.32%  ±1.72%
zlib/creation.js n=500000 options='true' type='DeflateRaw'                    ***      2.79 %       ±1.06%  ±1.41%  ±1.83%
zlib/creation.js n=500000 options='true' type='Gunzip'                        ***      3.27 %       ±1.03%  ±1.37%  ±1.79%
zlib/creation.js n=500000 options='true' type='Gzip'                          ***      2.94 %       ±1.17%  ±1.56%  ±2.03%
zlib/creation.js n=500000 options='true' type='Inflate'                       ***      3.73 %       ±1.04%  ±1.39%  ±1.82%
zlib/creation.js n=500000 options='true' type='InflateRaw'                    ***      3.04 %       ±0.84%  ±1.12%  ±1.46%
zlib/creation.js n=500000 options='true' type='Unzip'                         ***      3.08 %       ±1.02%  ±1.36%  ±1.77%
zlib/creation.js n=500000 options='true' type='ZstdCompress'                          -0.26 %       ±0.69%  ±0.92%  ±1.19%
zlib/creation.js n=500000 options='true' type='ZstdDecompress'                        -0.11 %       ±1.28%  ±1.70%  ±2.22%
zlib/deflate.js n=400000 inputLen=1024 method='createDeflate'                         -2.07 %       ±2.60%  ±3.46%  ±4.51%
zlib/deflate.js n=400000 inputLen=1024 method='deflate'                                0.22 %       ±1.13%  ±1.50%  ±1.95%
zlib/deflate.js n=400000 inputLen=1024 method='deflateSync'                   ***      0.72 %       ±0.29%  ±0.39%  ±0.51%
zlib/inflate.js n=400000 inputLen=1024 method='inflate'                                0.54 %       ±0.69%  ±0.92%  ±1.20%
zlib/inflate.js n=400000 inputLen=1024 method='inflateSync'                   ***      3.87 %       ±1.08%  ±1.43%  ±1.86%
zlib/pipe.js algorithm='brotli' type='buffer' duration=5 inputLen=1024                 0.57 %       ±0.60%  ±0.79%  ±1.03%
zlib/pipe.js algorithm='brotli' type='string' duration=5 inputLen=1024          *      0.65 %       ±0.54%  ±0.72%  ±0.93%
zlib/pipe.js algorithm='gzip' type='buffer' duration=5 inputLen=1024                  -5.04 %      ±14.64% ±19.49% ±25.39%
zlib/pipe.js algorithm='gzip' type='string' duration=5 inputLen=1024                  -0.00 %       ±3.04%  ±4.05%  ±5.27%
zlib/pipe.js algorithm='zstd' type='buffer' duration=5 inputLen=1024                  -0.14 %       ±0.47%  ±0.63%  ±0.82%
zlib/pipe.js algorithm='zstd' type='string' duration=5 inputLen=1024                  -0.07 %       ±0.72%  ±0.96%  ±1.25%

Be aware that when doing many comparisons the risk of a false-positive
result increases. In this case, there are 42 comparisons, you can thus
expect the following amount of false-positive results:
  2.10 false positives, when considering a   5% risk acceptance (*, **, ***),
  0.42 false positives, when considering a   1% risk acceptance (**, ***),
  0.04 false positives, when considering a 0.1% risk acceptance (***)

@aduh95 aduh95 added author ready PRs that have at least one approval, no pending requests for changes, and a CI started. request-ci Add this label to start a Jenkins CI on a PR. labels Nov 25, 2025
@github-actions github-actions bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Nov 25, 2025
@nodejs-github-bot
Copy link
Collaborator

@LiviaMedeiros
Copy link
Member Author

Comparing it against ReflectApply, not .call, correct?

Correct. LiviaMedeiros@69cef00 against 8dc2bdd.

V8 optimising is definitely surprising, how come we get a worse perf on ZstdDecompress?!

Zstd constructor is different than others in zlib, the perf difference seems to be within error margin, or maybe caused by something smaller like unfortunate memory allocation or cache miss.

@nodejs-github-bot
Copy link
Collaborator

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

author ready PRs that have at least one approval, no pending requests for changes, and a CI started. http2 Issues or PRs related to the http2 subsystem. needs-benchmark-ci PR that need a benchmark CI run. needs-ci PRs that need a full CI run. zlib Issues and PRs related to the zlib subsystem.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants