Does the integer type matter for Bitvec::store

The bitvec documentation provides this example of using a bitvec here:

use bitvec::prelude::*;

let mut bv = bitvec![u8, Msb0; 0; 40];
bv[0 .. 10].store::<u16>(0x3A8);
bv[10 .. 20].store::<u16>(0x2F9);
bv[20 .. 30].store::<u16>(0x154);
bv[30 .. 40].store::<u16>(0x06D);

My question is, does the generic integer parameter on store matter for speed?

For example, would

bv[0 .. 10].store::<u16>(0x3A8);

be the same speed as

bv[0 .. 10].store::<usize>(0x3A8);

or would the usize variant be slower?


Basically, the integer type determines the integer type of the underlying vector of numbers representing the bits. You can think that if you have a bitvec of u16, then it will have a "slice" of u16's, while if you have a u64, you'll have a slice of u64's.
There may be marginal differences in speed, for cumulative lookups, such as count or find first 0.
I tend to just stick a usize and be done with it. If you profile and discover that it really matters, then you can go ahead and benchmark. Otherwise, just use usize.


Ahh ok, that makes sense. Thank you!