GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — util: improve text-decoder performance by anonrig · Pull Request #45363 · nodejs/node

Conversation

@anonrig

@anonrig anonrig commented Nov 7, 2022 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

This pull request fixes previous benchmarks, improves it, and later improves the performance of the input for SharedArrayBuffer and ArrayBuffer on TextDecoder.decode

Based on @jasnell's recommendation

cc @nodejs/performance

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

                                                                                                 confidence improvement accuracy (*)    (**)   (***)
util/text-decoder.js type='ArrayBuffer' n=100 len=16384 ignoreBOM=0 encoding='iso-8859-3'                        7.47 %       ±9.99% ±13.30% ±17.31%
util/text-decoder.js type='ArrayBuffer' n=100 len=16384 ignoreBOM=0 encoding='latin1'                     *     10.43 %       ±8.50% ±11.30% ±14.71%
util/text-decoder.js type='ArrayBuffer' n=100 len=16384 ignoreBOM=0 encoding='utf-8'                             5.30 %       ±6.78%  ±9.04% ±11.81%
util/text-decoder.js type='ArrayBuffer' n=100 len=16384 ignoreBOM=1 encoding='iso-8859-3'                        0.11 %       ±9.96% ±13.25% ±17.24%
util/text-decoder.js type='ArrayBuffer' n=100 len=16384 ignoreBOM=1 encoding='latin1'                            2.40 %       ±8.54% ±11.36% ±14.78%
util/text-decoder.js type='ArrayBuffer' n=100 len=16384 ignoreBOM=1 encoding='utf-8'                             3.43 %       ±8.74% ±11.64% ±15.17%
util/text-decoder.js type='ArrayBuffer' n=100 len=256 ignoreBOM=0 encoding='iso-8859-3'                 ***     32.84 %      ±12.48% ±16.65% ±21.74%
util/text-decoder.js type='ArrayBuffer' n=100 len=256 ignoreBOM=0 encoding='latin1'                     ***     27.25 %      ±10.74% ±14.31% ±18.66%
util/text-decoder.js type='ArrayBuffer' n=100 len=256 ignoreBOM=0 encoding='utf-8'                      ***     36.39 %      ±13.64% ±18.18% ±23.73%
util/text-decoder.js type='ArrayBuffer' n=100 len=256 ignoreBOM=1 encoding='iso-8859-3'                 ***     29.60 %      ±11.42% ±15.21% ±19.81%
util/text-decoder.js type='ArrayBuffer' n=100 len=256 ignoreBOM=1 encoding='latin1'                     ***     26.58 %      ±11.86% ±15.78% ±20.54%
util/text-decoder.js type='ArrayBuffer' n=100 len=256 ignoreBOM=1 encoding='utf-8'                      ***     26.81 %      ±10.96% ±14.58% ±18.98%
util/text-decoder.js type='ArrayBuffer' n=100 len=524288 ignoreBOM=0 encoding='iso-8859-3'                      -3.16 %       ±6.15%  ±8.18% ±10.65%
util/text-decoder.js type='ArrayBuffer' n=100 len=524288 ignoreBOM=0 encoding='latin1'                           2.83 %       ±7.06%  ±9.40% ±12.24%
util/text-decoder.js type='ArrayBuffer' n=100 len=524288 ignoreBOM=0 encoding='utf-8'                           -3.08 %       ±6.04%  ±8.05% ±10.48%
util/text-decoder.js type='ArrayBuffer' n=100 len=524288 ignoreBOM=1 encoding='iso-8859-3'                      -2.60 %       ±7.61% ±10.13% ±13.19%
util/text-decoder.js type='ArrayBuffer' n=100 len=524288 ignoreBOM=1 encoding='latin1'                          -2.27 %       ±7.37%  ±9.80% ±12.76%
util/text-decoder.js type='ArrayBuffer' n=100 len=524288 ignoreBOM=1 encoding='utf-8'                            4.71 %       ±6.94%  ±9.24% ±12.03%
util/text-decoder.js type='Buffer' n=100 len=16384 ignoreBOM=0 encoding='iso-8859-3'                             6.20 %      ±11.38% ±15.15% ±19.73%
util/text-decoder.js type='Buffer' n=100 len=16384 ignoreBOM=0 encoding='latin1'                                 5.15 %       ±9.10% ±12.12% ±15.79%
util/text-decoder.js type='Buffer' n=100 len=16384 ignoreBOM=0 encoding='utf-8'                                  0.88 %      ±11.25% ±14.96% ±19.48%
util/text-decoder.js type='Buffer' n=100 len=16384 ignoreBOM=1 encoding='iso-8859-3'                            -5.50 %       ±9.90% ±13.18% ±17.15%
util/text-decoder.js type='Buffer' n=100 len=16384 ignoreBOM=1 encoding='latin1'                                 1.15 %       ±8.39% ±11.17% ±14.55%
util/text-decoder.js type='Buffer' n=100 len=16384 ignoreBOM=1 encoding='utf-8'                                  3.79 %      ±14.27% ±18.99% ±24.71%
util/text-decoder.js type='Buffer' n=100 len=256 ignoreBOM=0 encoding='iso-8859-3'                               9.18 %      ±11.30% ±15.04% ±19.58%
util/text-decoder.js type='Buffer' n=100 len=256 ignoreBOM=0 encoding='latin1'                            *     15.81 %      ±13.25% ±17.73% ±23.28%
util/text-decoder.js type='Buffer' n=100 len=256 ignoreBOM=0 encoding='utf-8'                                    2.84 %      ±10.10% ±13.45% ±17.51%
util/text-decoder.js type='Buffer' n=100 len=256 ignoreBOM=1 encoding='iso-8859-3'                              -0.79 %      ±11.28% ±15.02% ±19.58%
util/text-decoder.js type='Buffer' n=100 len=256 ignoreBOM=1 encoding='latin1'                                   3.46 %       ±9.30% ±12.38% ±16.13%
util/text-decoder.js type='Buffer' n=100 len=256 ignoreBOM=1 encoding='utf-8'                                    2.41 %       ±9.73% ±12.96% ±16.87%
util/text-decoder.js type='Buffer' n=100 len=524288 ignoreBOM=0 encoding='iso-8859-3'                            6.12 %       ±6.78%  ±9.02% ±11.74%
util/text-decoder.js type='Buffer' n=100 len=524288 ignoreBOM=0 encoding='latin1'                                3.18 %       ±6.18%  ±8.22% ±10.70%
util/text-decoder.js type='Buffer' n=100 len=524288 ignoreBOM=0 encoding='utf-8'                                 0.28 %       ±7.33%  ±9.77% ±12.73%
util/text-decoder.js type='Buffer' n=100 len=524288 ignoreBOM=1 encoding='iso-8859-3'                           -3.97 %       ±6.21%  ±8.27% ±10.76%
util/text-decoder.js type='Buffer' n=100 len=524288 ignoreBOM=1 encoding='latin1'                               -4.25 %       ±6.72%  ±8.94% ±11.63%
util/text-decoder.js type='Buffer' n=100 len=524288 ignoreBOM=1 encoding='utf-8'                                -0.13 %       ±4.92%  ±6.54%  ±8.51%
util/text-decoder.js type='SharedArrayBuffer' n=100 len=16384 ignoreBOM=0 encoding='iso-8859-3'           *     12.96 %      ±10.21% ±13.59% ±17.71%
util/text-decoder.js type='SharedArrayBuffer' n=100 len=16384 ignoreBOM=0 encoding='latin1'               *     15.27 %      ±13.12% ±17.54% ±23.00%
util/text-decoder.js type='SharedArrayBuffer' n=100 len=16384 ignoreBOM=0 encoding='utf-8'                *      9.76 %       ±8.54% ±11.37% ±14.80%
util/text-decoder.js type='SharedArrayBuffer' n=100 len=16384 ignoreBOM=1 encoding='iso-8859-3'                  7.90 %       ±8.94% ±11.92% ±15.55%
util/text-decoder.js type='SharedArrayBuffer' n=100 len=16384 ignoreBOM=1 encoding='latin1'                      5.69 %      ±10.00% ±13.31% ±17.33%
util/text-decoder.js type='SharedArrayBuffer' n=100 len=16384 ignoreBOM=1 encoding='utf-8'                       8.02 %       ±9.13% ±12.15% ±15.82%
util/text-decoder.js type='SharedArrayBuffer' n=100 len=256 ignoreBOM=0 encoding='iso-8859-3'           ***     37.73 %      ±13.23% ±17.71% ±23.27%
util/text-decoder.js type='SharedArrayBuffer' n=100 len=256 ignoreBOM=0 encoding='latin1'               ***     33.53 %      ±10.06% ±13.40% ±17.49%
util/text-decoder.js type='SharedArrayBuffer' n=100 len=256 ignoreBOM=0 encoding='utf-8'                 **     18.71 %      ±10.85% ±14.45% ±18.82%
util/text-decoder.js type='SharedArrayBuffer' n=100 len=256 ignoreBOM=1 encoding='iso-8859-3'           ***     36.62 %      ±10.20% ±13.58% ±17.71%
util/text-decoder.js type='SharedArrayBuffer' n=100 len=256 ignoreBOM=1 encoding='latin1'               ***     29.98 %       ±6.95%  ±9.24% ±12.04%
util/text-decoder.js type='SharedArrayBuffer' n=100 len=256 ignoreBOM=1 encoding='utf-8'                ***     29.35 %       ±9.48% ±12.62% ±16.43%
util/text-decoder.js type='SharedArrayBuffer' n=100 len=524288 ignoreBOM=0 encoding='iso-8859-3'                -0.31 %       ±6.59%  ±8.77% ±11.42%
util/text-decoder.js type='SharedArrayBuffer' n=100 len=524288 ignoreBOM=0 encoding='latin1'                    -0.23 %       ±7.59% ±10.11% ±13.16%
util/text-decoder.js type='SharedArrayBuffer' n=100 len=524288 ignoreBOM=0 encoding='utf-8'                     -0.15 %       ±6.81%  ±9.06% ±11.79%
util/text-decoder.js type='SharedArrayBuffer' n=100 len=524288 ignoreBOM=1 encoding='iso-8859-3'                 0.32 %       ±7.52% ±10.01% ±13.04%
util/text-decoder.js type='SharedArrayBuffer' n=100 len=524288 ignoreBOM=1 encoding='latin1'                    -2.21 %       ±7.33%  ±9.76% ±12.71%
util/text-decoder.js type='SharedArrayBuffer' n=100 len=524288 ignoreBOM=1 encoding='utf-8'                     -1.12 %       ±7.53% ±10.02% ±13.05%

Be aware that when doing many comparisons the risk of a false-positive
result increases. In this case, there are 54 comparisons, you can thus
expect the following amount of false-positive results:
  2.70 false positives, when considering a   5% risk acceptance (*, **, ***),
  0.54 false positives, when considering a   1% risk acceptance (**, ***),
  0.05 false positives, when considering a 0.1% risk acceptance (***)

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

bricss and daliborgogic reacted with thumbs up emoji
All reactions
  • 👍 2 reactions
@anonrig anonrig added performance Issues and PRs related to the performance of Node.js. encoding Issues and PRs related to the TextEncoder and TextDecoder APIs. commit-queue-rebase PRs the Commit Queue should land as multiple self-contained commits. labels Nov 7, 2022
@nodejs-github-bot nodejs-github-bot added c++ Issues and PRs that require attention from people who are familiar with C++. i18n-api Issues and PRs related to Node.js internationalization support. needs-ci PRs that need a full CI run. labels Nov 7, 2022
@anonrig
anonrig force-pushed the perf/text-decoder-v2 branch from d7b5ec1 to 8349faa Compare November 7, 2022 14:38
@anonrig anonrig added the request-ci Add this label to start a Jenkins CI on a PR. Only starts once the PR has an approving review. label Nov 7, 2022
@anonrig

anonrig commented Nov 7, 2022

Copy link
Copy Markdown
Member Author

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

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@github-actions github-actions Bot removed the request-ci Add this label to start a Jenkins CI on a PR. Only starts once the PR has an approving review. label Nov 7, 2022
@nodejs-github-bot

This comment was marked as outdated.

Sign in to view
@mscdex

mscdex commented Nov 7, 2022

Copy link
Copy Markdown
Contributor

FWIW it'd be better to post the results as text instead of a screenshot of the results.

anonrig reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@anonrig

anonrig commented Nov 7, 2022

Copy link
Copy Markdown
Member Author

FWIW it'd be better to post the results as text instead of a screenshot of the results.

I'll do it after the benchmark ci is completed.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@anonrig
anonrig force-pushed the perf/text-decoder-v2 branch from 8349faa to 31d97d1 Compare November 7, 2022 15:01
@anonrig anonrig added the request-ci Add this label to start a Jenkins CI on a PR. Only starts once the PR has an approving review. label Nov 7, 2022
@github-actions github-actions Bot removed the request-ci Add this label to start a Jenkins CI on a PR. Only starts once the PR has an approving review. label Nov 7, 2022
@nodejs-github-bot

nodejs-github-bot commented Nov 7, 2022

Copy link
Copy Markdown
Collaborator

CI: https://ci.nodejs.org/job/node-test-pull-request/47763/

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@anonrig anonrig changed the title util: improve text-decoder performance up to 31% util: improve text-decoder performance up to 37% Nov 7, 2022
@tniessen

tniessen commented Nov 7, 2022

Copy link
Copy Markdown
Member

(Side note: while a good sales strategy, I guess, it is not very scientific to cherry-pick the highest percentage and put it into the title. A different set of benchmarks would likely give you an entirely different result.)

BridgeAR reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@anonrig anonrig changed the title util: improve text-decoder performance up to 37% util: improve text-decoder performance Nov 7, 2022
@anonrig

anonrig commented Nov 7, 2022 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member Author

(Side note: while a good sales strategy, I guess, it is not very scientific to cherry-pick the highest percentage and put it into the title. A different set of benchmarks would likely give you an entirely different result.)

I removed it. (This is why I added up to)

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@nodejs-github-bot

nodejs-github-bot commented Nov 7, 2022

Copy link
Copy Markdown
Collaborator

CI: https://ci.nodejs.org/job/node-test-pull-request/47767/

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

addaleax
addaleax reviewed Nov 7, 2022
View reviewed changes
Comment thread lib/internal/encoding.js Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread src/node_i18n.cc Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread src/util-inl.h Resolved

Uh oh!

There was an error while loading. Please reload this page.

anonrig added 2 commits November 7, 2022 14:13
@anonrig
benchmark: fix text-decoder benchmark
aa9fa58
@anonrig
benchmark: add parameters to text-decoder benchmark
d621bc7
@anonrig
anonrig force-pushed the perf/text-decoder-v2 branch from 31d97d1 to ad9c389 Compare November 7, 2022 19:13
@anonrig anonrig added the request-ci Add this label to start a Jenkins CI on a PR. Only starts once the PR has an approving review. label Nov 7, 2022
@github-actions github-actions Bot removed the request-ci Add this label to start a Jenkins CI on a PR. Only starts once the PR has an approving review. label Nov 7, 2022
@nodejs-github-bot

This comment was marked as outdated.

Sign in to view
addaleax
addaleax approved these changes Nov 7, 2022
View reviewed changes
Comment thread src/util-inl.h Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread src/util-inl.h Resolved

Uh oh!

There was an error while loading. Please reload this page.

RafaelGSS pushed a commit that referenced this pull request Nov 10, 2022
@anonrig @RafaelGSS
benchmark: add parameters to text-decoder benchmark
c9cf399
PR-URL: #45363
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Rich Trott <[email protected]>
RafaelGSS pushed a commit that referenced this pull request Nov 10, 2022
@anonrig @RafaelGSS
util: improve text-decoder performance
89390a6
PR-URL: #45363
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Rich Trott <[email protected]>
@RafaelGSS RafaelGSS mentioned this pull request Nov 10, 2022
v19.1.0 proposal #45269
Merged
This was referenced Nov 11, 2022
CI Reliability 2022-11-11 nodejs/reliability#425
Open
CI Reliability 2022-11-12 nodejs/reliability#426
Open
@anonrig anonrig mentioned this pull request Nov 27, 2022
[v18.x backport] backport utf8 performance improvements #45650
Closed
anonrig added a commit to anonrig/node that referenced this pull request Nov 28, 2022
@anonrig
benchmark: fix text-decoder benchmark
f5e3920
PR-URL: nodejs#45363
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Rich Trott <[email protected]>
anonrig added a commit to anonrig/node that referenced this pull request Nov 28, 2022
@anonrig
benchmark: add parameters to text-decoder benchmark
22e9f5b
PR-URL: nodejs#45363
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Rich Trott <[email protected]>
anonrig added a commit to anonrig/node that referenced this pull request Nov 28, 2022
@anonrig
util: improve text-decoder performance
26fbc98
PR-URL: nodejs#45363
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Rich Trott <[email protected]>
@anonrig anonrig added lts-watch-v14.x labels Nov 28, 2022
@danielleadams danielleadams mentioned this pull request Dec 30, 2022
v18.13.0 release proposal #46025
Merged
danielleadams pushed a commit that referenced this pull request Dec 30, 2022
@anonrig @danielleadams
benchmark: fix text-decoder benchmark
ac457a4
PR-URL: #45363
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Rich Trott <[email protected]>
danielleadams pushed a commit that referenced this pull request Dec 30, 2022
@anonrig @danielleadams
benchmark: add parameters to text-decoder benchmark
d86be20
PR-URL: #45363
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Rich Trott <[email protected]>
danielleadams pushed a commit that referenced this pull request Dec 30, 2022
@anonrig @danielleadams
util: improve text-decoder performance
96c9525
PR-URL: #45363
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Rich Trott <[email protected]>
danielleadams pushed a commit that referenced this pull request Jan 3, 2023
@anonrig @danielleadams
benchmark: fix text-decoder benchmark
ab891ec
PR-URL: #45363
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Rich Trott <[email protected]>
danielleadams pushed a commit that referenced this pull request Jan 3, 2023
@anonrig @danielleadams
benchmark: add parameters to text-decoder benchmark
762d285
PR-URL: #45363
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Rich Trott <[email protected]>
danielleadams pushed a commit that referenced this pull request Jan 3, 2023
@anonrig @danielleadams
util: improve text-decoder performance
1dc91ab
PR-URL: #45363
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Rich Trott <[email protected]>
@richardlau richardlau removed the lts-watch-v14.x label Jan 27, 2023
@richardlau richardlau removed the lts-watch-v16.x label Aug 24, 2023
@targos targos added backported-to-v18.x and removed lts-watch-v18.x labels Oct 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@BridgeAR BridgeAR BridgeAR left review comments
@Trott Trott Trott approved these changes
@addaleax addaleax addaleax approved these changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

c++ Issues and PRs that require attention from people who are familiar with C++. commit-queue-rebase PRs the Commit Queue should land as multiple self-contained commits. encoding Issues and PRs related to the TextEncoder and TextDecoder APIs. i18n-api Issues and PRs related to Node.js internationalization support. needs-ci PRs that need a full CI run. performance Issues and PRs related to the performance of Node.js.

Projects

None yet

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.

12 participants

@anonrig @nodejs-github-bot @mscdex @tniessen @aduh95 @BridgeAR @joyeecheung @cjihrig @Trott @addaleax @targos @richardlau
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.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.