perf(websocket): unroll client frame masking - #5809
Open
dexhunter wants to merge 1 commit into
Open
Conversation
Refs nodejs#3201, nodejs#2927 Co-Authored-By: Aiden <aiden@weco.ai>
Member
|
@tsctx PTAL |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #5809 +/- ##
==========================================
- Coverage 93.50% 93.50% -0.01%
==========================================
Files 110 110
Lines 39521 39544 +23
==========================================
+ Hits 36954 36974 +20
- Misses 2567 2570 +3 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Member
|
The title of this PR is "perf" but there are no benchmarks nor benchmark results. |
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
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.
This relates to...
Existing issues #3201 and #2927.
Rationale
Client WebSocket frames are masked before they are written. The masking path currently performs one loop iteration per byte. This change keeps the existing mask generation and wire format, while processing eight bytes per iteration and handling the remaining bytes with the existing byte-wise semantics.
Changes
Features
N/A
Bug Fixes
Reduces the CPU work in the maintained WebSocket masking path without changing frame semantics.
Breaking Changes and Deprecations
N/A
Validation
node --test test/websocket/frame.js: 3 passed.npm run lint: passed.ws8.20.1, loopback, no compression, one connection, and one in-flight message. The five paired runs used AB BA AB BA AB order, with two seconds of warmup and one second of measurement per cell. The primary binary median of per-run p50 values changed from 876.749 µs to 797.448 µs (-9.045%). All five paired rows improved; median p99 improved 3.915%, CPU time improved 9.426%, and the small-payload controls were flat.Status