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

Use the is_utf8 library #109

Merged
merged 1 commit into from
Jan 3, 2023
Merged

Use the is_utf8 library #109

merged 1 commit into from
Jan 3, 2023

Conversation

lpinca
Copy link
Member

@lpinca lpinca commented Dec 27, 2022

Use the is_utf8 library to greatly improve performance.

Supersedes #101.

@lemire
Copy link

lemire commented Dec 30, 2022

I think websockets has a threshold: it only calls the fast utf-8-validate for sizeable strings. I suspect that if you greatly accelerate utf-8-validate, the threshold should be lowered. That is, it begins to pay to include smaller strings because despite the call overhead, the high processing speed should even things out. It should be 'easy' to benchmark.

@lpinca
Copy link
Member Author

lpinca commented Dec 31, 2022

Do you mean https://github.com/websockets/ws/blob/d412358ccb5320bc00c8993ecd5d9b992df0753e/lib/validation.js#L120? If so, yes I plan to revisit the threshold when this lands.

@lemire
Copy link

lemire commented Dec 31, 2022

That’s correct. The threshold is probably necessary because of the function call overhead.

Use the is_utf8 [1] library to greatly improve performance.

[1]: https://github.com/simdutf/is_utf8
@lpinca lpinca merged commit c10c452 into master Jan 3, 2023
@lpinca lpinca deleted the use/is_utf8 branch January 3, 2023 20:15
@lpinca lpinca mentioned this pull request Jan 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants