str::splitn(N, ' ') is slower than it ought to be #82471
Labels
A-str
Area: str and String
C-enhancement
Category: An issue proposing an enhancement or a PR with one.
I-slow
Issue: Problems and improvements with respect to performance of generated code.
T-libs
Relevant to the library team, which will review and decide on the PR/issue.
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: