Skip to content
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 masking could a lot faster #1801

Open
gdamore opened this issue Mar 17, 2024 · 0 comments
Open

Websocket masking could a lot faster #1801

gdamore opened this issue Mar 17, 2024 · 0 comments

Comments

@gdamore
Copy link
Contributor

gdamore commented Mar 17, 2024

The current masking code is fairly naive and masks a byte at a time. But pretty much everyone has 64-bit operations (and some even have 128-bit SIMD operations).

It's possible that optimizers are good enough to mask this efficiently already, but from what I observe on godbolt, even under -O3 both clang and gcc don't optimize this well - at least for x86.

The interesting concerns here will be dealing with misaligned data, which is not an issue on x86, and for modern ARM (aarch64) is usually not an issue.

Fixing this would be substantial for high bandwidth Websocket messages.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant