GeezerVison is showing github.com — lib: optimize TextEncoder.encode for short strings by mertcanaltin · Pull Request #66831 · nodejs/node
Conversation
This pr improvement short strings for TextEncoder.encode.
Benchmark results:
(.venv) ➜ node git:(mert/textencoder-small-string) ✗ npx node-benchmark-compare te-clean.csv
confidence improvement accuracy (*) (**) (***)
util/text-encoder.js op='encode' type='ascii' n=1000000 len=256 * 1.67 % ±1.45% ±1.94% ±2.54%
util/text-encoder.js op='encode' type='ascii' n=1000000 len=32 *** 127.18 % ±1.93% ±2.58% ±3.40%
util/text-encoder.js op='encode' type='one-byte-string' n=1000000 len=256 1.39 % ±2.07% ±2.79% ±3.68%
util/text-encoder.js op='encode' type='one-byte-string' n=1000000 len=32 *** 85.44 % ±2.43% ±3.27% ±4.31%
util/text-encoder.js op='encode' type='two-byte-string' n=1000000 len=256 -0.12 % ±0.86% ±1.15% ±1.49%
util/text-encoder.js op='encode' type='two-byte-string' n=1000000 len=32 *** 74.83 % ±1.45% ±1.94% ±2.54%
Be aware that when doing many comparisons the risk of a false-positive result increases.
In this case, there are 6 comparisons, you can thus expect the following amount of false-positive results:
0.30 false positives, when considering a 5% risk acceptance (*, **, ***),
0.06 false positives, when considering a 1% risk acceptance (**, ***),
0.01 false positives, when considering a 0.1% risk acceptance (***)
I got help from Claude Opus 5.5. I reviewed the changes and ran the tests and benchmarks myself.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
bricss and AugustinMauroy reacted with rocket emoji
Uh oh!
There was an error while loading. Please reload this page.
codecov
Bot
commented
Oct 18, 2026
•
edited
Loading
Uh oh!
There was an error while loading. Please reload this page.
|
✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.51%. Comparing base (e2d5522) to head (cdf9f11).
⚠️ Report is 74 commits behind head on main.
Additional details and impacted files
@@ Coverage Diff @@
## main #66831 +/- ##
==========================================
+ Coverage 90.50% 90.51% +0.01%
==========================================
Files 797 797
Lines 277793 278237 +444
Branches 53366 53466 +100
==========================================
+ Hits 251405 251838 +433
+ Misses 16801 16765 -36
- Partials 9587 9634 +47
... and 61 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.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
aduh95
added
author ready
PRs with CI started, the required approvals, and no outstanding review comments.
request-ci
Add this label to start a Jenkins CI on a PR. Only starts once the PR has an approving review.
commit-queue-squash
PRs the Commit Queue should land as one squashed commit.
labels
Oct 21, 2026
|
Benchmark GHA (util / text-encoder): https://github.com/nodejs/node/actions/runs/39607879277
Results
[!WARNING]
Do not take GHA benchmark results as face value, always confirm them
using a dedicated machine, e.g. Jenkins CI.
Benchmark results:
confidence improvement accuracy (*) (**) (***)
util/text-encoder.js op='encode' type='ascii' n=1000000 len=1024 -2.59 % ±17.90% ±23.59% ±30.27%
util/text-encoder.js op='encode' type='ascii' n=1000000 len=256 2.01 % ±22.07% ±29.09% ±37.33%
util/text-encoder.js op='encode' type='ascii' n=1000000 len=32 *** 172.54 % ±31.10% ±41.03% ±52.72%
util/text-encoder.js op='encode' type='ascii' n=1000000 len=8192 0.66 % ±16.04% ±21.14% ±27.13%
util/text-encoder.js op='encode' type='one-byte-string' n=1000000 len=1024 2.12 % ±18.63% ±24.56% ±31.51%
util/text-encoder.js op='encode' type='one-byte-string' n=1000000 len=256 -1.85 % ±19.74% ±26.02% ±33.39%
util/text-encoder.js op='encode' type='one-byte-string' n=1000000 len=32 *** 140.33 % ±25.69% ±33.87% ±43.49%
util/text-encoder.js op='encode' type='one-byte-string' n=1000000 len=8192 0.51 % ±7.77% ±10.24% ±13.14%
util/text-encoder.js op='encode' type='two-byte-string' n=1000000 len=1024 -1.62 % ±16.32% ±21.51% ±27.60%
util/text-encoder.js op='encode' type='two-byte-string' n=1000000 len=256 -1.19 % ±18.34% ±24.17% ±31.01%
util/text-encoder.js op='encode' type='two-byte-string' n=1000000 len=32 *** 132.39 % ±22.45% ±29.60% ±37.99%
util/text-encoder.js op='encode' type='two-byte-string' n=1000000 len=8192 -0.16 % ±7.29% ±9.61% ±12.33%
util/text-encoder.js op='encodeInto' type='ascii' n=1000000 len=1024 -0.30 % ±17.92% ±23.63% ±30.31%
util/text-encoder.js op='encodeInto' type='ascii' n=1000000 len=256 1.12 % ±20.39% ±26.88% ±34.49%
util/text-encoder.js op='encodeInto' type='ascii' n=1000000 len=32 -4.04 % ±17.34% ±22.85% ±29.33%
util/text-encoder.js op='encodeInto' type='ascii' n=1000000 len=8192 0.84 % ±8.20% ±10.81% ±13.87%
util/text-encoder.js op='encodeInto' type='one-byte-string' n=1000000 len=1024 0.86 % ±13.22% ±17.42% ±22.36%
util/text-encoder.js op='encodeInto' type='one-byte-string' n=1000000 len=256 -0.60 % ±16.01% ±21.11% ±27.08%
util/text-encoder.js op='encodeInto' type='one-byte-string' n=1000000 len=32 2.46 % ±19.34% ±25.49% ±32.70%
util/text-encoder.js op='encodeInto' type='one-byte-string' n=1000000 len=8192 0.50 % ±5.69% ±7.50% ±9.62%
util/text-encoder.js op='encodeInto' type='two-byte-string' n=1000000 len=1024 0.03 % ±9.57% ±12.61% ±16.19%
util/text-encoder.js op='encodeInto' type='two-byte-string' n=1000000 len=256 2.47 % ±12.39% ±16.33% ±20.96%
util/text-encoder.js op='encodeInto' type='two-byte-string' n=1000000 len=32 2.54 % ±17.87% ±23.56% ±30.23%
util/text-encoder.js op='encodeInto' type='two-byte-string' n=1000000 len=8192 0.04 % ±6.00% ±7.91% ±10.15%
Be aware that when doing many comparisons the risk of a false-positive
result increases. In this case, there are 24 comparisons, you can thus
expect the following amount of false-positive results:
1.20 false positives, when considering a 5% risk acceptance (*, **, ***),
0.24 false positives, when considering a 1% risk acceptance (**, ***),
0.02 false positives, when considering a 0.1% risk acceptance (***)
[!WARNING]
Do not take GHA benchmark results as face value, always confirm them
using a dedicated machine, e.g. Jenkins CI.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Commit Queue failed
✖ GitHub CI failed with status: FAILURE
✖ 3 failure(s) on the last Jenkins CI run
The pull request was removed from the Commit Queue and labeled
commit-queue-failed
PRs whose Commit Queue landing failed and need manual intervention before retrying.
. After resolving the failure, remove that label and add
commit-queue
PRs queued for automated landing through the Commit Queue.
to retry.
Full Commit Queue output
�[36m⠋�[39m Loading data for nodejs/node/pull/66831
�[36m⠋�[39m Loading data for nodejs/node/pull/66831
�[36m⠋�[39m Getting collaborator contacts from README of nodejs/node
�[36m⠋�[39m Getting PR from nodejs/node/pull/66831
�[36m⠋�[39m Getting reviews from nodejs/node/pull/66831
�[36m⠋�[39m Getting comments from nodejs/node/pull/66831
�[36m⠋�[39m Getting commits from nodejs/node/pull/66831
✔ Done loading data for nodejs/node/pull/66831
----------------------------------- PR info ------------------------------------
Title lib: optimize TextEncoder.encode for short strings (#66831)
Author Mert Can Altin <[email protected]> (@mertcanaltin)
Branch mertcanaltin:mert/textencoder-small-string -> nodejs:main
Labels encoding, author ready, needs-ci, commit-queue, commit-queue-squash
Commits 4
- lib: optimize TextEncoder.encode for short strings
- Update test/parallel/test-whatwg-encoding-custom-textencoder-short.js
- lint
- added comment
Committers 2
- Mert Can Altin <[email protected]>
- GitHub <[email protected]>
PR-URL: https://github.com/nodejs/node/pull/66831
Reviewed-By: Antoine du Hamel <[email protected]>
Reviewed-By: Yagiz Nizipli <[email protected]>
Reviewed-By: Robert Nagy <[email protected]>
------------------------------ Generated metadata ------------------------------
PR-URL: https://github.com/nodejs/node/pull/66831
Reviewed-By: Antoine du Hamel <[email protected]>
Reviewed-By: Yagiz Nizipli <[email protected]>
Reviewed-By: Robert Nagy <[email protected]>
--------------------------------------------------------------------------------
ℹ This PR was created on Sun, 18 Oct 2026 12:20:32 GMT
✔ Approvals: 3
✔ - Antoine du Hamel (@aduh95) (TSC): https://github.com/nodejs/node/pull/66831#pullrequestreview-5600401401
✔ - Yagiz Nizipli (@anonrig) (TSC): https://github.com/nodejs/node/pull/66831#pullrequestreview-5601243454
✔ - Robert Nagy (@ronag) (TSC): https://github.com/nodejs/node/pull/66831#pullrequestreview-5620506743
✖ GitHub CI failed with status: FAILURE
ℹ Last Full PR CI on 2026-10-21T13:36:27Z: https://ci.nodejs.org/job/node-test-pull-request/78544/
�[36m⠙�[39m Querying data for job/node-test-pull-request/78544/
�[36m⠙�[39m Querying data for job/node-test-pull-request/78544/
�[36m⠙�[39m Querying API for job/node-test-pull-request/78544/
✔ Build data downloaded
�[36m⠹�[39m Querying failures of job/node-test-commit/93443/
�[36m⠹�[39m Querying failures of job/node-test-commit/93443/
�[36m⠹�[39m Querying API for job/node-test-commit-aix/66206/
�[36m⠹�[39m Querying API for job/node-test-commit-windows-fanned/81327/
�[36m⠸�[39m Querying API for job/node-test-commit-aix/nodes=aix73-power9/66206/
�[36m⠸�[39m Querying console text for job/node-test-commit-aix/nodes=aix73-power9/66206/
�[36m⠼�[39m Querying API for job/node-test-binary-windows-js-suites/44034/
�[36m⠴�[39m Querying API for job/node-test-binary-windows-js-suites/RUN_SUBSET=0,nodes=win11-vs2022-arm64-COMPILED_BY-vs2022_clang-arm64/44034/
�[36m⠴�[39m Querying API for job/node-test-binary-windows-js-suites/RUN_SUBSET=2,nodes=win2016-COMPILED_BY-vs2022-x86/44030/
�[36m⠦�[39m Querying console text for job/node-test-binary-windows-js-suites/RUN_SUBSET=0,nodes=win11-vs2022-arm64-COMPILED_BY-vs2022_clang-arm64/44034/
✔ Data downloaded
✖ 3 failure(s) on the last Jenkins CI run
--------------------------------------------------------------------------------
✔ Aborted `git node land` session in /home/runner/work/node/node/.ncu
View workflow run
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
panva
added
resume-ci
Add this label to resume the latest eligible Jenkins CI run on a PR with an approving review.
and removed
commit-queue-failed
PRs whose Commit Queue landing failed and need manual intervention before retrying.
labels
Oct 23, 2026
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Assignees
No one assigned
Labels
author ready
PRs with CI started, the required approvals, and no outstanding review comments.
commit-queue-squash
PRs the Commit Queue should land as one squashed commit.
encoding
Issues and PRs related to the TextEncoder and TextDecoder APIs.
needs-ci
PRs that need a full CI run.
Milestone
No milestone
Development
Successfully merging this pull request may close these issues.
Uh oh!
There was an error while loading. Please reload this page.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
|