Skip to content

Conversation

@ChALkeR
Copy link
Member

@ChALkeR ChALkeR commented Feb 1, 2026

Let's try this for the hex part of #60249

This PR exists mainly to run benchmarks for now

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%

@nodejs-github-bot
Copy link
Collaborator

Review requested:

  • @nodejs/security-wg

@nodejs-github-bot nodejs-github-bot added dependencies Pull requests that update a dependency file. needs-ci PRs that need a full CI run. labels Feb 1, 2026
@ChALkeR ChALkeR added the performance Issues and PRs related to the performance of Node.js. label Feb 2, 2026
@ChALkeR ChALkeR marked this pull request as ready for review February 2, 2026 07:01
@ChALkeR ChALkeR marked this pull request as draft February 2, 2026 07:01
@ChALkeR ChALkeR changed the title deps: try different HexEncode impl deps: rewrite HexEncode impl Feb 2, 2026
@ChALkeR
Copy link
Member Author

ChALkeR commented Feb 2, 2026

nbytes PR: nodejs/nbytes#12

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

Labels

dependencies Pull requests that update a dependency file. needs-ci PRs that need a full CI run. performance Issues and PRs related to the performance of Node.js.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants