-
Notifications
You must be signed in to change notification settings - Fork 549
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
websocket: improve frame parsing #3447
base: main
Are you sure you want to change the base?
Conversation
I'd prefer if there was a benchmark to measure the change. |
As an example, the 256Kib receive benchmark is 1.2x faster. |
Benchmarking websockets is hard and there is no benchmark to verify. |
It is a simple benchmark using console.time. |
This comment was marked as outdated.
This comment was marked as outdated.
I'd prefer a benchmark that uses WebSocket, not websocket internals. If #3203 could be completed, and then this PR benchmarked against that, I wouldn't have any complaints. |
22d310a
to
a6b399a
Compare
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.
lgtm
@KhafraDev Would you be able to revisit this? This is the result of the #3203's of benchmarks. before / after > $ node ./benchmarks/websocket-benchmark.mjs
(node:11148) [UNDICI-WSS] Warning: WebSocketStream is experimental! Expect it to change at any time.
(Use `node --trace-warnings ...` to show where the warning was created)
undici [binary]: transferred 95.78MiB Bytes/s
undici [string]: transferred 92.98MiB Bytes/s
undici - stream [binary]: transferred 95.93MiB Bytes/s
undici - stream [string]: transferred 97.00MiB Bytes/s
ws [binary]: transferred 125.82MiB Bytes/s
ws [string]: transferred 117.20MiB Bytes/s
> $ node ./benchmarks/websocket-benchmark.mjs
(node:3924) [UNDICI-WSS] Warning: WebSocketStream is experimental! Expect it to change at any time.
(Use `node --trace-warnings ...` to show where the warning was created)
undici [binary]: transferred 113.48MiB Bytes/s
undici [string]: transferred 112.11MiB Bytes/s
undici - stream [binary]: transferred 106.25MiB Bytes/s
undici - stream [string]: transferred 91.41MiB Bytes/s
ws [binary]: transferred 122.96MiB Bytes/s
ws [string]: transferred 114.50MiB Bytes/s |
Adjust to avoid creating a temporary buffer