This repository was archived by the owner on Nov 9, 2025. It is now read-only.
Merged
Conversation
840098f to
26b78a8
Compare
Contributor
Author
|
I'll probably strip the std-string benches out of here so these are just for this crate fns. |
This was referenced Sep 13, 2025
Contributor
Author
|
FYI I moved my comparison with std to https://github.com/alexheretic/rust-string-bench. |
c4d1c06 to
307b2f5
Compare
307b2f5 to
74883cd
Compare
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.
I was curious to quantify the performance of
SmolStrinline strings vs naiveStrings. I wrote some criterion benchmarks for lengths 12, 50, 1000to see inline vs heap perf differences.I would expect inline SmolStrs to generally perform better than Strings, and heap SmolStrs to perform a little worse. However, the numbers seem generally worse almost everywhere exceptSmolStr::clone. Can anyone comment on this and help me understand why this would be?Update: It seems the microbenches can be an easy place for the allocator to optimise, so I'll take a look elsewhere at improving a bench comparing allocating with non-allocating. Here we can just have some benches for this crate. I've stripped the benches to only being for this crate here.
Results