Skip to content

trivikr/benchmark-node-crc32

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

benchmark-node-crc32

Benchmarking Node.js zlib.crc32 with @node-rs/crc32

Pre-requisites

  • Install Node.js, and choose a supported version.
  • Install corepack npm i -g corepack.
  • Install dependencies by running pnpm i.
  • Run benchmark with pnpm benchmark.

Output from GitHub workflow runs

Node.js native crc32 computation appears to be 2.3X that of implementation provided by @node-rs/crc32.

node 20.x

node:zlib/crc32 vs @node-rs/crc32
┌─────────┬───────────────────┬──────────────────┬──────────────────┬────────────────────────┬────────────────────────┬─────────┐
│ (index) │ Task name         │ Latency avg (ns) │ Latency med (ns) │ Throughput avg (ops/s) │ Throughput med (ops/s) │ Samples │
├─────────┼───────────────────┼──────────────────┼──────────────────┼────────────────────────┼────────────────────────┼─────────┤
│ 0       │ 'node:zlib/crc32' │ '3951.3 ± 0.19%' │ '3907.0 ± 10.00' │ '254920 ± 0.06%'       │ '255951 ± 657'         │ 25309   │
│ 1       │ '@node-rs/crc32'  │ '1702.9 ± 0.65%' │ '1633.0 ± 10.00' │ '603127 ± 0.06%'       │ '612370 ± 3727'        │ 58725   │
└─────────┴───────────────────┴──────────────────┴──────────────────┴────────────────────────┴────────────────────────┴─────────┘

node 22.x

node:zlib/crc32 vs @node-rs/crc32
┌─────────┬───────────────────┬──────────────────┬──────────────────┬────────────────────────┬────────────────────────┬─────────┐
│ (index) │ Task name         │ Latency avg (ns) │ Latency med (ns) │ Throughput avg (ops/s) │ Throughput med (ops/s) │ Samples │
├─────────┼───────────────────┼──────────────────┼──────────────────┼────────────────────────┼────────────────────────┼─────────┤
│ 0       │ 'node:zlib/crc32' │ '3967.2 ± 0.18%' │ '3927.0 ± 10.00' │ '253777 ± 0.06%'       │ '254647 ± 650'         │ 25207   │
│ 1       │ '@node-rs/crc32'  │ '1760.7 ± 3.67%' │ '1643.0 ± 10.00' │ '595994 ± 0.07%'       │ '608643 ± 3727'        │ 56796   │
└─────────┴───────────────────┴──────────────────┴──────────────────┴────────────────────────┴────────────────────────┴─────────┘

node 24.x

node:zlib/crc32 vs @node-rs/crc32
┌─────────┬───────────────────┬──────────────────┬──────────────────┬────────────────────────┬────────────────────────┬─────────┐
│ (index) │ Task name         │ Latency avg (ns) │ Latency med (ns) │ Throughput avg (ops/s) │ Throughput med (ops/s) │ Samples │
├─────────┼───────────────────┼──────────────────┼──────────────────┼────────────────────────┼────────────────────────┼─────────┤
│ 0       │ 'node:zlib/crc32' │ '3963.9 ± 0.20%' │ '3907.0 ± 11.00' │ '254189 ± 0.06%'       │ '255951 ± 719'         │ 25228   │
│ 1       │ '@node-rs/crc32'  │ '1724.4 ± 0.66%' │ '1643.0 ± 10.00' │ '596815 ± 0.07%'       │ '608643 ± 3727'        │ 57993   │
└─────────┴───────────────────┴──────────────────┴──────────────────┴────────────────────────┴────────────────────────┴─────────┘

About

Benchmarking Node.js zlib.crc32 with @node-rs/crc32

Resources

License

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published