Skip to content

Conversation

@ChALkeR
Copy link
Member

@ChALkeR ChALkeR commented Feb 2, 2026

See nodejs/node#61609

This improves Buffer#toString('hex')  2-4x

In local tests on a MacBook, this improves .toString('hex') throughput from ~2.24 GiB/s to ~9.53 GiB/s on ~80 KiB chunks
For comparison, Uint8Array#toHex() shows 3.28 GiB/s.

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

10:57:55                                                 confidence improvement accuracy (*)   (**)  (***)
10:57:55 buffers/buffer-hex-decode.js n=1000000 len=1024        ***    170.96 %       ±1.02% ±1.38% ±1.82%
10:57:55 buffers/buffer-hex-decode.js n=1000000 len=64          ***     53.49 %       ±1.65% ±2.20% ±2.88%
10:57:55 buffers/buffer-hex-encode.js n=1000000 len=1024                 0.13 %       ±0.19% ±0.25% ±0.32%
10:57:55 buffers/buffer-hex-encode.js n=1000000 len=64                  -0.14 %       ±0.85% ±1.13% ±1.47%

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants