-
Notifications
You must be signed in to change notification settings - Fork 143
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
Understanding deserialization performance of SmallVec vs Vec #106
Comments
Thanks for the benchmark! May I add it to the smallvec repo? SmallVec's In the case where |
Thanks for the detailed description, that is very interesting. And yes, please, feel free to add this benchmark to the repo. |
My unsafe code is here: Unfortunately this is no longer as fast as Vec after I fixed a bug where it could panic on malformed input. It's only a 5–10% improvement (still about 25–50% slower than Vec), and I'm not sure that's worth adding more unsafe code. |
should we just chalk this up to "rustc/llvm need to work a little harder"? |
I was profiling my serde deserialization library and I went down the rabbit hole of benchmarking different KV container storage types. Got down to
Vec<(&'a[u8], &'a[u8]>
as the fastest and I wanted to see if my code would be faster by putting those string pointers on the stack. So I tried out SmallVec, was actually a little bit slower (20%) than vec. Should this be expected? I did not consider memory gains but the deserialization change doesn't make sense to me.I extract my benchmark to run inside of rust-smallvec:
on my laptop this spits out these numbers:
The text was updated successfully, but these errors were encountered: