BitSet vs BitVector

Thank you all very much for the detailed explanations.


For the case, that somebody should wonder how crate BitVec can be used with a static 64-bit set, here is a short example:

use bitvec::prelude::*;

fn main() {
    let mut c: BitArr!(for 64, in u64) = bitarr![u64, Lsb0; 0; 64];
    let mut d = bitarr![u64, Lsb0; 0; 64];
    println!("{}", c.len()); // 64
    println!("{}", c[0]); //  false
    c.set(0, true);
    println!("{}", c[0]); // true
    c.set(0, false);
    println!("{}", c[0]); // false
    c.set(0, true);
    let h = 1;
    d.set(h, true);
    let x = c | d; // bitor
    println!("{} {} {} {}", x[0], x[1], x[2], x.any());

A short test in my chess engine actually seems to result in slower performance compared to the crates BitSet and BitVector, at least when compiled in debug mode. For now it is enough for me that I have learned how I might use the BitVec crate -- later I might further investigate the actual performance or generated assembly code.