Skip to content

Use the is_utf8 library - #109

Merged
lpinca merged 1 commit into
masterfrom
use/is_utf8
Jan 3, 2023
Merged

Use the is_utf8 library#109
lpinca merged 1 commit into
masterfrom
use/is_utf8

Conversation

@lpinca

@lpinca lpinca commented Dec 27, 2022

Copy link
Copy Markdown
Member

Use the is_utf8 library to greatly improve performance.

Supersedes #101.

@lemire

lemire commented Dec 30, 2022

Copy link
Copy Markdown

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

lpinca commented Dec 31, 2022

Copy link
Copy Markdown
Member Author

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

lemire commented Dec 31, 2022

Copy link
Copy Markdown

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.

2 participants