This repository was archived by the owner on Nov 9, 2025. It is now read-only.
Optimise to_lowercase_smolstr, to_uppercase_smolstr#98
Merged
alexheretic merged 3 commits intorust-analyzer:masterfrom Oct 22, 2025
Merged
Optimise to_lowercase_smolstr, to_uppercase_smolstr#98alexheretic merged 3 commits intorust-analyzer:masterfrom
to_lowercase_smolstr, to_uppercase_smolstr#98alexheretic merged 3 commits intorust-analyzer:masterfrom
Conversation
alexheretic
commented
Sep 14, 2025
5a72c2f to
34691c1
Compare
Contributor
Author
|
@Veykril any issues with this? It would be nice to get these, and the other pr, improvements into a new smol_str release. |
Member
|
Ah sorry, forgot about this, I'll try to get back to this + do a release the coming week as I am a bit busy right now (if I'm not coming back to this this week please aggressively re-ping me) |
Contributor
Author
Veykril
approved these changes
Oct 22, 2025
Member
|
I threw you a collaborator invite, so go ahead and rebase and merge the other PRs. I'll do a release when the other PRs are merged then. |
689b878 to
f72703e
Compare
Contributor
Author
All merged now, thanks! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Optimisation opportunity highlighted by testing against
Stringperf and using benchmarks in #96.This is slightly more involved than the ascii optimisations in #97. I ported std
convert_while_asciiinto an inline versioninline_convert_while_asciito get an equivalent ascii-optimistic optimisation to theStringversion.PR bench
The change provides a significant perf improvement on inline & heap reprs. Also faster than String for len=12 now 🙂.
The benchmark is favourable to this optimisation as it measures a string with mostly ascii prefix. But I think this is a very common case for this method so the optimisation makes sense generally, and clearly std think so too.