-
Notifications
You must be signed in to change notification settings - Fork 500
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
Optimization of websocket masking #3265
Comments
Well. we could reduce the for loop overhead by doing 4 masking operations instead of one. |
As I indicated earlier. The masking is as far as I know totally useless for backend and could just be skipped... |
Maybe instead of i + 4 < length, you precalculate that too const lengthFor4 = length - (length & 3) |
This comment was marked as resolved.
This comment was marked as resolved.
maybe for the last potential 3 operations a duffs device? |
yes? |
Something like this. Sry, I still suffer from a heat stroke and cant provide better code. switch (length & 3) {
case 3:
buffer[i + 3] ^ mask[3]
case 2:
buffer[i + 2] ^ mask[2]
case 2:
buffer[i + 1] ^ mask[1]
...
|
Take care and get well soon. |
I give this up |
as titled
This is a cause of poor performance.
undici/lib/web/websocket/frame.js
Lines 85 to 88 in 0980f9d
The text was updated successfully, but these errors were encountered: