Skip to content

src: improve textEncoder encode performance with simdutf - #61496

Merged
nodejs-github-bot merged 1 commit into
nodejs:mainfrom
mertcanaltin:mert/textencoder-encode-simdutf
Jan 30, 2026
Merged

src: improve textEncoder encode performance with simdutf#61496
nodejs-github-bot merged 1 commit into
nodejs:mainfrom
mertcanaltin:mert/textencoder-encode-simdutf

Conversation

@mertcanaltin

@mertcanaltinmertcanaltin commented Jan 23, 2026

Copy link
Copy Markdown
Member

Ref: cloudflare/workerd#5448

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

 confidence improvement accuracy (*) (**) (***)
util/text-encoder.js op='encode' type='ascii' n=1000000 len=1024 *** 11.86 % ±1.25% ±1.66% ±2.17%
util/text-encoder.js op='encode' type='ascii' n=1000000 len=256 *** -7.82 % ±1.84% ±2.46% ±3.22%
util/text-encoder.js op='encode' type='ascii' n=1000000 len=32 * 1.26 % ±1.19% ±1.59% ±2.07%
util/text-encoder.js op='encode' type='ascii' n=1000000 len=8192 *** 146.74 % ±0.78% ±1.05% ±1.39%
util/text-encoder.js op='encode' type='one-byte-string' n=1000000 len=1024 *** 20.69 % ±0.79% ±1.05% ±1.37%
util/text-encoder.js op='encode' type='one-byte-string' n=1000000 len=256 *** 7.46 % ±0.79% ±1.05% ±1.37%
util/text-encoder.js op='encode' type='one-byte-string' n=1000000 len=32 -0.57 % ±0.91% ±1.21% ±1.58%
util/text-encoder.js op='encode' type='one-byte-string' n=1000000 len=8192 *** 182.16 % ±0.22% ±0.29% ±0.39%
util/text-encoder.js op='encode' type='two-byte-string' n=1000000 len=1024 *** 95.53 % ±1.09% ±1.47% ±1.95%
util/text-encoder.js op='encode' type='two-byte-string' n=1000000 len=256 *** 32.64 % ±0.90% ±1.20% ±1.58%
util/text-encoder.js op='encode' type='two-byte-string' n=1000000 len=32 -0.23 % ±1.04% ±1.38% ±1.80%
util/text-encoder.js op='encode' type='two-byte-string' n=1000000 len=8192 *** 299.06 % ±0.64% ±0.86% ±1.14%
util/text-encoder.js op='encodeInto' type='ascii' n=1000000 len=1024 2.14 % ±3.97% ±5.29% ±6.88%
util/text-encoder.js op='encodeInto' type='ascii' n=1000000 len=256 1.22 % ±3.31% ±4.41% ±5.75%
util/text-encoder.js op='encodeInto' type='ascii' n=1000000 len=32 *** 20.60 % ±2.77% ±3.69% ±4.80%
util/text-encoder.js op='encodeInto' type='ascii' n=1000000 len=8192 0.91 % ±3.13% ±4.16% ±5.42%
util/text-encoder.js op='encodeInto' type='one-byte-string' n=1000000 len=1024 1.21 % ±5.16% ±6.88% ±8.99%
util/text-encoder.js op='encodeInto' type='one-byte-string' n=1000000 len=256 -0.65 % ±1.12% ±1.49% ±1.94%
util/text-encoder.js op='encodeInto' type='one-byte-string' n=1000000 len=32 -0.48 % ±3.29% ±4.38% ±5.70%
util/text-encoder.js op='encodeInto' type='one-byte-string' n=1000000 len=8192 -1.57 % ±1.69% ±2.25% ±2.94%
util/text-encoder.js op='encodeInto' type='two-byte-string' n=1000000 len=1024 -0.51 % ±0.69% ±0.92% ±1.20%
util/text-encoder.js op='encodeInto' type='two-byte-string' n=1000000 len=256 -0.38 % ±0.67% ±0.89% ±1.16%
util/text-encoder.js op='encodeInto' type='two-byte-string' n=1000000 len=32 * -2.35 % ±2.05% ±2.73% ±3.55%
util/text-encoder.js op='encodeInto' type='two-byte-string' n=1000000 len=8192 * -0.32 % ±0.31% ±0.41% ±0.54%

@nodejs-github-botnodejs-github-bot added c++ Issues and PRs that require attention from people who are familiar with C++. needs-ci PRs that need a full CI run. labels Jan 23, 2026
@mertcanaltin
mertcanaltin marked this pull request as draft January 23, 2026 19:47
@codecov

codecovBot commented Jan 23, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 63.15789% with 21 lines in your changes missing coverage. Please review.
✅ Project coverage is 89.76%. Comparing base (ea83d32) to head (2b60e66).
⚠️ Report is 272 commits behind head on main.

Files with missing linesPatch %Lines
src/encoding_binding.cc63.15%17 Missing and 4 partials ⚠️
Additional details and impacted files
@@ Coverage Diff @@## main #61496 +/- ##
==========================================
- Coverage 89.79% 89.76% -0.04% 
==========================================
Files 673 673 Lines 203852 203901 +49 Branches 39181 39188 +7 ==========================================
- Hits 183044 183024 -20 - Misses 13143 13208 +65 - Partials 7665 7669 +4 
Files with missing linesCoverage Δ
src/encoding_binding.cc52.92% <63.15%> (+0.79%)⬆️

... and 37 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.

@mertcanaltin
mertcanaltin marked this pull request as ready for review January 30, 2026 19:20
@mertcanaltin
mertcanaltinforce-pushed the mert/textencoder-encode-simdutf branch from 0c17bf1 to 2b60e66CompareJanuary 30, 2026 19:31
@anonrig

Copy link
Copy Markdown
Member

cc @nodejs/performance please review

@anonriganonrig 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. notable-change PRs with changes that should be highlighted in changelogs. labels Jan 30, 2026
@github-actions

Copy link
Copy Markdown
Contributor

The notable-changePRs with changes that should be highlighted in changelogs. label has been added by @anonrig.

Please suggest a text for the release notes if you'd like to include a more detailed summary, then proceed to update the PR description with the text or a link to the notable change suggested text comment. Otherwise, the commit will be placed in the Other Notable Changes section.

@github-actionsgithub-actionsBot removed the request-ci Add this label to start a Jenkins CI on a PR. label Jan 30, 2026
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

@nodejsnodejs locked and limited conversation to collaborators Jan 30, 2026
@nodejsnodejs unlocked this conversation Jan 30, 2026
@anonrig

Copy link
Copy Markdown
Member

@IlyasShabi why did you locked and limited the conversation to collaborators?

@IlyasShabi

Copy link
Copy Markdown
Member

@anonrig oh! Sorry didn't know what happened, didn't mean to do it.

@anonriganonrig added the commit-queue Add this label to land a pull request using GitHub Actions. label Jan 30, 2026
@nodejs-github-botnodejs-github-bot removed the commit-queue Add this label to land a pull request using GitHub Actions. label Jan 30, 2026
@nodejs-github-bot
nodejs-github-bot merged commit f200685 into nodejs:mainJan 30, 2026
74 checks passed
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

Landed in f200685

aduh95 pushed a commit that referenced this pull request Feb 2, 2026
PR-URL: #61496
Refs: cloudflare/workerd#5448
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
Reviewed-By: Daniel Lemire <daniel@lemire.me>
nodejs-github-bot added a commit that referenced this pull request Feb 2, 2026
Notable changes:
async_hooks:
* (SEMVER-MINOR) add trackPromises option to createHook() (Joyee Cheung) #61415
src:
* improve textEncoder encode performance with simdutf (Mert Can Altin) #61496
stream:
* (SEMVER-MINOR) add bytes() method to stream/consumers (wantaek) #60426
test_runner:
* (SEMVER-MINOR) add env option to run function (Ethan Arrowood) #61367
url:
* update ada to v3.4.2 and support unicode 17 (Yagiz Nizipli) #61593
PR-URL: #61635
aduh95 pushed a commit that referenced this pull request Feb 2, 2026
PR-URL: #61496
Refs: cloudflare/workerd#5448
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
Reviewed-By: Daniel Lemire <daniel@lemire.me>
aduh95 added a commit that referenced this pull request Feb 2, 2026
Notable changes:
async_hooks:
* (SEMVER-MINOR) add `trackPromises` option to `createHook()` (Joyee Cheung) #61415
net:
* (SEMVER-MINOR) add `setTOS` and `getTOS` to `Socket` (Amol Yadav) #61503
src:
* (SEMVER-MINOR) add initial support for ESM in embedder API (Joyee Cheung) #61548
* improve `TextEncoder` encode performance with `simdutf` (Mert Can Altin) #61496
stream:
* (SEMVER-MINOR) add `bytes()` method to `node:stream/consumers` (wantaek) #60426
test_runner:
* (SEMVER-MINOR) add `env` option to `run` function (Ethan Arrowood) #61367
url:
* update Ada to v3.4.2 and support Unicode 17 (Yagiz Nizipli) #61593
PR-URL: #61635
aduh95 added a commit that referenced this pull request Feb 3, 2026
Notable changes:
async_hooks:
* (SEMVER-MINOR) add `trackPromises` option to `createHook()` (Joyee Cheung) #61415
net:
* (SEMVER-MINOR) add `setTOS` and `getTOS` to `Socket` (Amol Yadav) #61503
src:
* (SEMVER-MINOR) add initial support for ESM in embedder API (Joyee Cheung) #61548
* improve `TextEncoder` encode performance with `simdutf` (Mert Can Altin) #61496
stream:
* (SEMVER-MINOR) add `bytes()` method to `node:stream/consumers` (wantaek) #60426
test_runner:
* (SEMVER-MINOR) add `env` option to `run` function (Ethan Arrowood) #61367
url:
* update Ada to v3.4.2 and support Unicode 17 (Yagiz Nizipli) #61593
PR-URL: #61635
@aduh95aduh95 added the backport-requested-v24.x PRs awaiting manual backport to the v24.x-staging branch. label Mar 9, 2026
@aduh95

Copy link
Copy Markdown
Contributor

This doesn't build when cherry-picked to v24.x-staging, and would require a manual backport if we want it on the 24.x release line

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

Labels

author readyPRs that have at least one approval, no pending requests for changes, and a CI started.backport-requested-v24.xPRs awaiting manual backport to the v24.x-staging branch.c++Issues and PRs that require attention from people who are familiar with C++.needs-ciPRs that need a full CI run.notable-changePRs with changes that should be highlighted in changelogs.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants

@mertcanaltin@anonrig@nodejs-github-bot@IlyasShabi@aduh95@lemire