This is my first piece of Rust code. I wrote it partly to learn how to work with the heap in Rust, and partly because I needed these for another project.
Checkout the benchmarks for ThinMap here:
I’d appreciate any feedback.
Cool project! Are there any downsides of these compared to those in the standard library?
ThinVec is very generic and compares quite well with
Vec. It’s a tiny bit slower on
push if you’re just using it by itself, but it quickly becomes better than
Vec if it’s used inside another data structure (e.g.
ThinSet are special purpose, mostly for primitives, or small key/values. If used as such, they are much better than
HashSet, with no downsides.
V64 is very special purpose. If you have vectors whose total population is expected to fit in 7 bytes, it’s much faster than
Vec, but otherwise, it takes about a 2x hit on push for large vectors (which is not where it’s meant to be used).