You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Because SmallVec has the capability to store elements inline for small lengths it has to make additional checks on whether an allocation or inline storage is being used. This introduces some overhead as evidenced in benchmarks.
In the use cases where I want to reach for a bitvec crate I typically expect to need to represent larger amount of bits than will fit inline in a SmallVec. So the allocation savings may not be significant enough to be worth this additional overhead.
I think it would be useful to consider replacing SmallVec with a plain Vec or making BitVecSimd generic over the backing storage.
The text was updated successfully, but these errors were encountered:
I think that's a good point. However, I'd advocate for the generic solution. I have two slightly different use-cases. For both of them, the maximum size is not known at compile time, but in one case the maximum size is known at runtime, when initialize my data structure.
In the case where I know the maximum size, and I know that it is smaller than a certain multiple of machine words, I'd use a BitVec that lives on the stack. In the other case I'd use a BitVec that in turn uses SmallVec to allocate as necessary.
Users that are only interested in a "larger amount of bits" could use an implementation based on Vec.
Because SmallVec has the capability to store elements inline for small lengths it has to make additional checks on whether an allocation or inline storage is being used. This introduces some overhead as evidenced in benchmarks.
In the use cases where I want to reach for a bitvec crate I typically expect to need to represent larger amount of bits than will fit inline in a
SmallVec
. So the allocation savings may not be significant enough to be worth this additional overhead.I think it would be useful to consider replacing
SmallVec
with a plainVec
or makingBitVecSimd
generic over the backing storage.The text was updated successfully, but these errors were encountered: