Skip to content

Conversation

@RafaelGSS
Copy link
Member

While investigating fetch performance (nodejs/undici#1203 (comment)) I've found that NodeError is a bottleneck in WebStreams.

I created this Pull Request to share the insights and help as I can to improve the NodeError performance. We can use this PR thread to discuss approaches to solve it.

For reference, this is the benchmark result I'm getting:

*-cpu description: CPU product: AMD Ryzen 5 3500X 6-Core Processor vendor: Advanced Micro Devices [AMD] physical id: 2f bus info: cpu@0 version: AMD Ryzen 5 3500X 6-Core Processor serial: Unknown slot: AM4 size: 4030MHz capacity: 4100MHz width: 64 bits clock: 100MHz
rafaelgss@rafaelgss-desktop:~/repos/os/node$ ./node benchmark/error/error.jserror/error.js disableEntropyCache=0 n=10000000: 506,239.3888750024error/error.js disableEntropyCache=1 n=10000000: 490,143.20360859093rafaelgss@rafaelgss-desktop:~/repos/os/node$ ./node benchmark/error/node-error.jserror/node-error.js disableEntropyCache=0 n=10000000: 159,137.83392330573error/node-error.js disableEntropyCache=1 n=10000000: 159,349.56687673234

cc: @jasnell@mcollina

@nodejs-github-botnodejs-github-bot added needs-ci PRs that need a full CI run. util Issues and PRs related to the built-in util module. labels May 12, 2022
@RafaelGSSRafaelGSS added discuss Issues opened for discussions and feedbacks. and removed util Issues and PRs related to the built-in util module. labels May 12, 2022
@RafaelGSS
Copy link
MemberAuthor

Furthermore, I can go deeper into the analysis and share my thoughts here.

@mscdex
Copy link
Contributor

What is the purpose of disableEntropyCache?

@RafaelGSSRafaelGSSforce-pushed the benchmark/node-error branch 2 times, most recently from 7a0b11e to f5ece4aCompareMay 24, 2022 14:47
Copy link
Member

@mcollinamcollina left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@RafaelGSS
Copy link
MemberAuthor

Well, lately I have had no time to investigate/improve how the NodeError is managed. I think it's ready to land with just the benchmark. I plan to back to it whenever I have free time.

A few insights to solve it can be found in: nodejs/undici#1203 (comment).

@RafaelGSSRafaelGSS marked this pull request as ready for review May 24, 2022 15:04
@RafaelGSSRafaelGSS added the request-ci Add this label to start a Jenkins CI on a PR. label May 24, 2022
@RafaelGSSRafaelGSS changed the title bench: node-error benchmarkbenchmark: Add NodeError and Error benchmarkMay 24, 2022
@github-actionsgithub-actionsbot removed the request-ci Add this label to start a Jenkins CI on a PR. label May 24, 2022
@nodejs-github-bot
Copy link
Collaborator

@nodejs-github-bot
Copy link
Collaborator

@RafaelGSSRafaelGSS added the author ready PRs that have at least one approval, no pending requests for changes, and a CI started. label May 25, 2022
@aduh95
Copy link
Contributor

@RafaelGSSRafaelGSSforce-pushed the benchmark/node-error branch from f5ece4a to 64fc8c1CompareMay 25, 2022 20:28
@aduh95
Copy link
Contributor

@aduh95
Copy link
Contributor

Can you add a test, similarly as

'use strict';
require('../common');
construnBenchmark=require('../common/benchmark');
runBenchmark('misc',{NODEJS_BENCHMARK_ZERO_ALLOWED: 1});

Copy link
Member

@juanarboljuanarbol left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@RafaelGSSRafaelGSSforce-pushed the benchmark/node-error branch from 64fc8c1 to df87435CompareMay 25, 2022 23:56
@RafaelGSS
Copy link
MemberAuthor

Can you add a test, similarly as

'use strict';
require('../common');
construnBenchmark=require('../common/benchmark');
runBenchmark('misc',{NODEJS_BENCHMARK_ZERO_ALLOWED: 1});

Just did, I knew I was forgetting something.

@aduh95aduh95 added the request-ci Add this label to start a Jenkins CI on a PR. label May 26, 2022
@github-actionsgithub-actionsbot removed the request-ci Add this label to start a Jenkins CI on a PR. label May 26, 2022
@nodejs-github-bot
Copy link
Collaborator

@nodejs-github-bot
Copy link
Collaborator

@nodejs-github-bot
Copy link
Collaborator

@RafaelGSSRafaelGSSforce-pushed the benchmark/node-error branch from df87435 to da88923CompareMay 27, 2022 11:47
@RafaelGSS
Copy link
MemberAuthor

Just rebased on master to check if the flaky tests are gone

@nodejs-github-bot
Copy link
Collaborator

@nodejs-github-bot
Copy link
Collaborator

@RafaelGSSRafaelGSS added the commit-queue Add this label to land a pull request using GitHub Actions. label May 30, 2022
@nodejs-github-botnodejs-github-bot added commit-queue-failed An error occurred while landing this pull request using GitHub Actions. and removed commit-queue Add this label to land a pull request using GitHub Actions. labels May 30, 2022
@nodejs-github-bot
Copy link
Collaborator

Commit Queue failed
- Loading data for nodejs/node/pull/43077 ✔ Done loading data for nodejs/node/pull/43077 ----------------------------------- PR info ------------------------------------ Title benchmark: Add NodeError and Error benchmark (#43077) Author Rafael Gonzaga (@RafaelGSS) Branch RafaelGSS:benchmark/node-error -> nodejs:master Labels discuss, author ready, needs-ci Commits 1 - benchmark: add node-error benchmark Committers 1 - RafaelGSS PR-URL: https://github.com/nodejs/node/pull/43077 Reviewed-By: Matteo Collina Reviewed-By: Juan José Arboleda Reviewed-By: Antoine du Hamel ------------------------------ Generated metadata ------------------------------ PR-URL: https://github.com/nodejs/node/pull/43077 Reviewed-By: Matteo Collina Reviewed-By: Juan José Arboleda Reviewed-By: Antoine du Hamel -------------------------------------------------------------------------------- ⚠ Commits were pushed since the last review: ⚠ - benchmark: add node-error benchmark ℹ This PR was created on Thu, 12 May 2022 19:26:45 GMT ✔ Approvals: 3 ✔ - Matteo Collina (@mcollina) (TSC): https://github.com/nodejs/node/pull/43077#pullrequestreview-983394804 ✔ - Juan José Arboleda (@juanarbol): https://github.com/nodejs/node/pull/43077#pullrequestreview-985584535 ✔ - Antoine du Hamel (@aduh95) (TSC): https://github.com/nodejs/node/pull/43077#pullrequestreview-985886311 ✔ Last GitHub CI successful ℹ Last Full PR CI on 2022-05-29T18:37:24Z: https://ci.nodejs.org/job/node-test-pull-request/44228/ ℹ Last Benchmark CI on 2022-05-25T23:03:58Z: https://ci.nodejs.org/view/Node.js%20benchmark/job/benchmark-node-micro-benchmarks/1145/ - Querying data for job/node-test-pull-request/44228/ ✔ Last Jenkins CI successful -------------------------------------------------------------------------------- ✔ Aborted `git node land` session in /home/runner/work/node/node/.ncu
https://github.com/nodejs/node/actions/runs/2409007414

@RafaelGSSRafaelGSS removed commit-queue-failed An error occurred while landing this pull request using GitHub Actions. discuss Issues opened for discussions and feedbacks. labels May 30, 2022
RafaelGSS added a commit that referenced this pull request May 30, 2022
PR-URL: #43077 Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Juan José Arboleda <[email protected]> Reviewed-By: Antoine du Hamel <[email protected]>
@RafaelGSS
Copy link
MemberAuthor

Landed in 0903515

bengl pushed a commit that referenced this pull request May 30, 2022
PR-URL: #43077 Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Juan José Arboleda <[email protected]> Reviewed-By: Antoine du Hamel <[email protected]>
@benglbengl mentioned this pull request May 31, 2022
F3n67u pushed a commit to F3n67u/node that referenced this pull request Jun 1, 2022
PR-URL: nodejs#43077 Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Juan José Arboleda <[email protected]> Reviewed-By: Antoine du Hamel <[email protected]>
danielleadams pushed a commit that referenced this pull request Jun 27, 2022
PR-URL: #43077 Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Juan José Arboleda <[email protected]> Reviewed-By: Antoine du Hamel <[email protected]>
targos pushed a commit that referenced this pull request Jul 12, 2022
PR-URL: #43077 Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Juan José Arboleda <[email protected]> Reviewed-By: Antoine du Hamel <[email protected]>
targos pushed a commit that referenced this pull request Jul 31, 2022
PR-URL: #43077 Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Juan José Arboleda <[email protected]> Reviewed-By: Antoine du Hamel <[email protected]>
@targostargos mentioned this pull request Aug 3, 2022
guangwong pushed a commit to noslate-project/node that referenced this pull request Oct 10, 2022
PR-URL: nodejs/node#43077 Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Juan José Arboleda <[email protected]> Reviewed-By: Antoine du Hamel <[email protected]>
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.needs-ciPRs that need a full CI run.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants

@RafaelGSS@mscdex@nodejs-github-bot@aduh95@mcollina@juanarbol