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
On a 64-bit platform, the current implementation (with the union feature flag) only allows for 16 u8s / 4 u32s inline if the total size of a SmallVec is 24 bytes. This is because the capacity unconditionally takes up 8 bytes as it is a usize. Would it make sense to only use 56 bits from the capacity (larger capacities are impractical anyways), and use the LSB/MSB (depending on endianness) of the capacity as a boolean?
That way, one could fit in 23 u8 values or 5 u32 values in the same space.
Happy to submit a patch if this would be useful.
The text was updated successfully, but these errors were encountered:
I took a shot at implementing this, but I don't know enough about the invariants required around the use of MaybeUninit and the what is safe to assume around offsets and alignment to make this work properly. I've implemented similar functionality in one of my crates but that is a more specialized situation with u8 array (so zeroing the array is fine).
On a 64-bit platform, the current implementation (with the
union
feature flag) only allows for 16u8
s / 4u32
s inline if the total size of a SmallVec is 24 bytes. This is because the capacity unconditionally takes up 8 bytes as it is ausize
. Would it make sense to only use 56 bits from the capacity (larger capacities are impractical anyways), and use the LSB/MSB (depending on endianness) of the capacity as a boolean?That way, one could fit in 23
u8
values or 5u32
values in the same space.Happy to submit a patch if this would be useful.
The text was updated successfully, but these errors were encountered: