-
Notifications
You must be signed in to change notification settings - Fork 3
feat: add basic benchmarks for webstreams #3
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
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
debadree25
commented
May 13, 2023
"url": "~/Developer/node/out/Release/node ./url/index.mjs && bun run ./url/index.mjs && deno run -A ./url/deno.js", | ||
"fetch": "~/Developer/node/out/Release/node ./fetch/index.mjs && bun run ./fetch/index.mjs && deno run -A ./fetch/deno.js", | ||
"buffer": "~/Developer/node/out/Release/node ./buffer/index.mjs && bun run ./buffer/index.mjs && deno run -A ./buffer/deno.js" | ||
"text-decoder": "node ./text-decoder/index.mjs && bun run ./text-decoder/index.mjs && deno run -A ./text-decoder/deno.js", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I updated the scripts here to directly use the installed node, makes it easier for anyone without the node source with them but lmk if this not preferable!
The results after running these > [email protected] webstreams /Users/debadreechatterjee/Documents/Personal/node-benchmarks
> node ./webstreams/index.mjs && bun run ./webstreams/index.mjs && deno run -A ./webstreams/deno.js
cpu: Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz
runtime: node v20.1.0 (x64-darwin)
benchmark time (avg) (min … max) p75 p99 p995
-------------------------------------------------------------------- -----------------------------
noop 267.28 ps/iter (249.3 ps … 18.54 ns) 257.5 ps 333 ps 346.9 ps
noop 4.5 ns/iter (4.3 ns … 20.49 ns) 4.41 ns 8.56 ns 10.7 ns
new ReadableStream 11.34 µs/iter (6.86 µs … 7.01 ms) 10.9 µs 25.14 µs 33.75 µs
new WritableStream 11.58 µs/iter (6.17 µs … 8.87 ms) 10.53 µs 32.08 µs 50.21 µs
new TransformStream 39.82 µs/iter (25.57 µs … 8.23 ms) 33.75 µs 70.64 µs 84.26 µs
Read from ReadableStream 947.11 ns/iter (782.36 ns … 2.78 µs) 950.45 ns 2.78 µs 2.78 µs
Write to WritableStream 1.27 µs/iter (985.93 ns … 3.05 µs) 1.22 µs 3.05 µs 3.05 µs
Transform in TransformStream 1.64 µs/iter (1.57 µs … 2.53 µs) 1.62 µs 2.53 µs 2.53 µs
cpu: Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz
runtime: bun 0.5.9 (x64-darwin)
benchmark time (avg) (min … max) p75 p99 p995
-------------------------------------------------------------------- -----------------------------
noop 262.06 ps/iter (249 ps … 11.92 ns) 252.7 ps 302.3 ps 386.2 ps
noop 2.08 ns/iter (1.47 ns … 18.97 ns) 1.47 ns 7.89 ns 8.01 ns
new ReadableStream 2.73 µs/iter (2.09 µs … 4.09 µs) 3.06 µs 4.09 µs 4.09 µs
new WritableStream 4.98 µs/iter (4.22 µs … 7.02 µs) 5.07 µs 7.02 µs 7.02 µs
new TransformStream 14.21 µs/iter (3.81 µs … 53.18 ms) 12.85 µs 28.62 µs 36.13 µs
Read from ReadableStream 707.18 ns/iter (662.4 ns … 958.55 ns) 708.49 ns 958.55 ns 958.55 ns
Write to WritableStream 1.69 µs/iter (1.17 µs … 4.36 µs) 1.84 µs 4.36 µs 4.36 µs
Transform in TransformStream 1.91 µs/iter (1.66 µs … 3.27 µs) 1.89 µs 3.27 µs 3.27 µs
cpu: unknown
runtime: deno 1.33.3 (x86_64-apple-darwin)
benchmark time (avg) (min … max) p75 p99 p995
-------------------------------------------------------------------- -----------------------------
noop 263.07 ps/iter (249 ps … 20.78 ns) 257.2 ps 263.8 ps 270.6 ps
noop 4.46 ns/iter (4.31 ns … 23.69 ns) 4.41 ns 9.04 ns 11.26 ns
new ReadableStream 1.44 µs/iter (741.27 ns … 4.53 µs) 1.55 µs 4.53 µs 4.53 µs
new WritableStream 3.11 µs/iter (1.81 µs … 8.99 µs) 2.58 µs 8.99 µs 8.99 µs
new TransformStream 7.31 µs/iter (1.05 µs … 30.42 ms) 1.51 µs 8.51 µs 94.07 µs
Read from ReadableStream 720.5 ns/iter (657.16 ns … 1.38 µs) 717.53 ns 1.38 µs 1.38 µs
Write to WritableStream 760.83 ns/iter (689.44 ns … 1.15 µs) 761.83 ns 1.15 µs 1.15 µs
Transform in TransformStream 1.94 µs/iter (1.78 µs … 3.01 µs) 1.93 µs 3.01 µs 3.01 µs |
Perfect! Thanks for the PR |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Hey! have tried to add a few small benchmarks for WebStreams here