Skip to content

stream: improve WebStreams creation performance - #49089

Merged
nodejs-github-bot merged 9 commits into
nodejs:mainfrom
rluvaton:improve-webstream-perf
Aug 13, 2023
Merged

stream: improve WebStreams creation performance#49089
nodejs-github-bot merged 9 commits into
nodejs:mainfrom
rluvaton:improve-webstream-perf

Conversation

@rluvaton

@rluvatonrluvaton commented Aug 9, 2023

Copy link
Copy Markdown
Member

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-botnodejs-github-bot added needs-ci PRs that need a full CI run. web streams labels Aug 9, 2023
@Xstoudi

Copy link
Copy Markdown
Contributor

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
Copy Markdown
Contributor

Seems to be failing a lot of WPTs too

Comment threadlib/internal/webstreams/readablestream.js Outdated
@rluvatonrluvaton changed the title stream: improve WebStreams performancestream: improve WebStreams creation performanceAug 10, 2023
@rluvaton

rluvaton commented Aug 10, 2023

Copy link
Copy Markdown
MemberAuthor

@mcollina

Copy link
Copy Markdown
Member

cc @jasnell

@rluvaton
rluvatonforce-pushed the improve-webstream-perf branch from 4bb72eb to ede6c54CompareAugust 10, 2023 17:11
@rluvaton

Copy link
Copy Markdown
MemberAuthor

fixed the tests

@mcollinamcollina added the request-ci Add this label to start a Jenkins CI on a PR. label Aug 11, 2023
@github-actionsgithub-actionsBot removed the request-ci Add this label to start a Jenkins CI on a PR. label Aug 11, 2023
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

@anonriganonrig 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
Copy Markdown
Member

@rluvaton

rluvaton commented Aug 11, 2023

Copy link
Copy Markdown
MemberAuthor

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 (***)

@mcollinamcollina left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

lgtm

@anonriganonrig 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
Copy Markdown
Collaborator

@rluvaton

Copy link
Copy Markdown
MemberAuthor

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

@atlowChemi

Copy link
Copy Markdown
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
Copy Markdown
Collaborator

@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

@atlowChemiatlowChemi 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-botnodejs-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:mainAug 13, 2023
@nodejs-github-bot

Copy link
Copy Markdown
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>
@UlisesGasconUlisesGascon 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>
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>
@targostargos mentioned this pull request Nov 28, 2023
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 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.commit-queue-squashAdd this label to instruct the Commit Queue to squash all the PR commits into the first one.needs-benchmark-ciPR that need a benchmark CI run.needs-ciPRs that need a full CI run.performanceIssues 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

@rluvaton@Xstoudi@debadree25@mcollina@nodejs-github-bot@anonrig@atlowChemi@benjamingr