Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

stream: improve WebStreams creation performance #49089

Merged
merged 9 commits into from
Aug 13, 2023

Conversation

rluvaton
Copy link
Member

@rluvaton rluvaton commented Aug 9, 2023

From my local tests, this improves the benchmark/webstreams/creation.js by 2 to 3 times

could someone please run the benchmark in the CI

@nodejs-github-bot nodejs-github-bot added needs-ci PRs that need a full CI run. web streams labels Aug 9, 2023
@Xstoudi
Copy link
Contributor

Xstoudi commented Aug 10, 2023

Ubuntu on WSL2

Without the change:

webstreams/creation.js kind="ReadableStream" n=50000: 245,842.89135667187
webstreams/creation.js kind="TransformStream" n=50000: 64,412.45274303109
webstreams/creation.js kind="WritableStream" n=50000: 235,646.29630427333

With change:

webstreams/creation.js kind="ReadableStream" n=50000: 796,678.8307839505
webstreams/creation.js kind="TransformStream" n=50000: 137,357.95549408294
webstreams/creation.js kind="WritableStream" n=50000: 503,433.1675202359

If values are rates and not times, your change seems to improve it on my end too!

@debadree25
Copy link
Member

Seems to be failing a lot of WPTs too

@rluvaton rluvaton changed the title stream: improve WebStreams performance stream: improve WebStreams creation performance Aug 10, 2023
@rluvaton
Copy link
Member Author

rluvaton commented Aug 10, 2023

@mcollina
Copy link
Member

cc @jasnell

@rluvaton rluvaton force-pushed the improve-webstream-perf branch from 4bb72eb to ede6c54 Compare August 10, 2023 17:11
@rluvaton
Copy link
Member Author

fixed the tests

@mcollina mcollina added the request-ci Add this label to start a Jenkins CI on a PR. label Aug 11, 2023
@github-actions github-actions bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Aug 11, 2023
@nodejs-github-bot
Copy link
Collaborator

@anonrig anonrig added needs-benchmark-ci PR that need a benchmark CI run. performance Issues and PRs related to the performance of Node.js. labels Aug 11, 2023
@anonrig
Copy link
Member

anonrig commented Aug 11, 2023

@rluvaton
Copy link
Member Author

rluvaton commented Aug 11, 2023

benchmark output:

                                                       confidence improvement accuracy (*)   (**)   (***)
webstreams/creation.js kind='ReadableStream' n=50000         ***    144.39 %       ±6.00% ±8.00% ±10.45%
webstreams/creation.js kind='TransformStream' n=50000        ***     98.61 %       ±3.81% ±5.11%  ±6.72%
webstreams/creation.js kind='WritableStream' n=50000         ***     85.25 %       ±6.30% ±8.44% ±11.08%
 
Be aware that when doing many comparisons the risk of a false-positive
result increases. In this case, there are 3 comparisons, you can thus
expect the following amount of false-positive results:
  0.15 false positives, when considering a   5% risk acceptance (*, **, ***),
  0.03 false positives, when considering a   1% risk acceptance (**, ***),
  0.00 false positives, when considering a 0.1% risk acceptance (***)

Copy link
Member

@mcollina mcollina left a comment

Choose a reason for hiding this comment

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

lgtm

@anonrig anonrig added the author ready PRs that have at least one approval, no pending requests for changes, and a CI started. label Aug 11, 2023
@nodejs-github-bot
Copy link
Collaborator

@rluvaton
Copy link
Member Author

Can you please retry the CI, the tests seems to be flaky

@atlowChemi
Copy link
Member

Can you please retry the CI, the tests seems to be flaky

Most of the failures are related to #49059 (comment)

@nodejs-github-bot
Copy link
Collaborator

@nodejs-github-bot
Copy link
Collaborator

@nodejs-github-bot
Copy link
Collaborator

@atlowChemi atlowChemi added commit-queue Add this label to land a pull request using GitHub Actions. commit-queue-squash Add this label to instruct the Commit Queue to squash all the PR commits into the first one. labels Aug 13, 2023
@nodejs-github-bot nodejs-github-bot removed the commit-queue Add this label to land a pull request using GitHub Actions. label Aug 13, 2023
@nodejs-github-bot nodejs-github-bot merged commit 9fc5700 into nodejs:main Aug 13, 2023
@nodejs-github-bot
Copy link
Collaborator

Landed in 9fc5700

@rluvaton rluvaton deleted the improve-webstream-perf branch August 13, 2023 08:56
Ceres6 pushed a commit to Ceres6/node that referenced this pull request Aug 14, 2023
PR-URL: nodejs#49089
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
RafaelGSS pushed a commit that referenced this pull request Aug 15, 2023
PR-URL: #49089
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
@UlisesGascon UlisesGascon mentioned this pull request Aug 15, 2023
RafaelGSS pushed a commit to RafaelGSS/node that referenced this pull request Aug 15, 2023
PR-URL: nodejs#49089
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
rluvaton added a commit to rluvaton/node that referenced this pull request Aug 15, 2023
PR-URL: nodejs#49089
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
RafaelGSS pushed a commit that referenced this pull request Aug 16, 2023
PR-URL: #49089
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
RafaelGSS pushed a commit that referenced this pull request Aug 17, 2023
PR-URL: #49089
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
targos pushed a commit that referenced this pull request Nov 27, 2023
PR-URL: #49089
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
sercher added a commit to sercher/graaljs that referenced this pull request Apr 25, 2024
PR-URL: nodejs/node#49089
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
sercher added a commit to sercher/graaljs that referenced this pull request Apr 25, 2024
PR-URL: nodejs/node#49089
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
author ready PRs that have at least one approval, no pending requests for changes, and a CI started. commit-queue-squash Add this label to instruct the Commit Queue to squash all the PR commits into the first one. needs-benchmark-ci PR that need a benchmark CI run. needs-ci PRs that need a full CI run. performance Issues and PRs related to the performance of Node.js. web streams
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants