Closed luizirber closed 4 years ago
Reasonable suggestion, even if it does expose the fact that we use 32-bit blocks. Last chance to revisit that decision - is u64 better? The method signature would be able to be supported even if we switch to u64 internally, though.
Thank you, nice.
Feel free to poke me if this doesn't get released "soon".
This PR adds a new constructor taking
capacity
andblocks
. I needed this because loading big bitsets using.from_iter
or.extend
was slow, and with this change it is much faster because it avoids all the conversions to find what bit to set. (Incidentally, if anyone has good approaches to load data from disk that avoids this PR, I'm interested).I really like all the other features in fixedbitset, and didn't want to lose them by switching to another crate... But I also understand that this is an invasive change, because it exposes internals and makes it harder to change how data is stored or accessed in the future.
Additional changes: maybe make the signature
pub unsafe fn with_capacity_and_blocks(bits: usize, data: Vec<Block>) -> Self
to indicate the caller is responsible for passingVec<block>
in the right format?