-
Notifications
You must be signed in to change notification settings - Fork 13.4k
str::splitn(N, ' ') is slower than it ought to be #82471
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
Comments
Hi. I would like to take this issue. |
@rustbot claim |
its worth mentioning that the changes made in #46735 (at least in 2025) already modify this code path; large gains cant really be expected, at least for this extremely small string. (and besides, memchr isnt really that good for extremely small strings, and rustc's memchr is not that good at all.) |
speed up charsearcher for ascii chars attempt at fixing rust-lang#82471 this implementation should be valid because ascii characters are always one byte and there are no continuation bytes that overlap with ascii characters im not completely sure that this is _always_ an improvement but it seems to be an improvement for this case and i dont think it can significantly regress any cases
@rustbot release-assignment |
Rollup merge of #141516 - bend-n:okay, r=workingjubilee speed up charsearcher for ascii chars attempt at fixing #82471 this implementation should be valid because ascii characters are always one byte and there are no continuation bytes that overlap with ascii characters im not completely sure that this is _always_ an improvement but it seems to be an improvement for this case and i dont think it can significantly regress any cases
@rustbot close |
speed up charsearcher for ascii chars attempt at fixing rust-lang/rust#82471 this implementation should be valid because ascii characters are always one byte and there are no continuation bytes that overlap with ascii characters im not completely sure that this is _always_ an improvement but it seems to be an improvement for this case and i dont think it can significantly regress any cases
Reopening as #141516 is getting reverted. |
speed up charsearcher for ascii chars attempt at fixing rust-lang#82471 this implementation should be valid because ascii characters are always one byte and there are no continuation bytes that overlap with ascii characters im not completely sure that this is _always_ an improvement but it seems to be an improvement for this case and i dont think it can significantly regress any cases
Uh oh!
There was an error while loading. Please reload this page.
I wrote a small benchmark and was surprised at how much slower it was using str::splitn rather than using bytes directly.
splitn
Time elapsed in parse_response() is: 2.290853462s
as bytes
Time elapsed in parse_response() is: 661.947666ms
Is it possible to do something similar to #46693 where if splitting on a single byte.
https://users.rust-lang.org/t/performance-comparison/56041/2
The text was updated successfully, but these errors were encountered: