Use BitSet in SparseBitMatrix.

A `ChunkedBitSet` has to be at least 2048 bits for it to outperform a
`BitSet`, because that's the chunk size. The largest `SparseBitMatrix`
encountered when compiling the compiler and the entire rustc-perf
benchmark suite is less than 600 bits.

This change is a tiny perf win, but the motivation is more about
avoiding uses of `ChunkedBitSet` outside of `MixedBitSet`.

The test change is necessary to avoid hitting the `<BitSet<T> as
BitRelations<ChunkedBitSet<T>>>::subtract` method that has
`unimplemented!` in its body and isn't otherwise used.
This commit is contained in:
Nicholas Nethercote 2024-12-05 12:49:04 +11:00
parent a06547508a
commit dd28c40c29
2 changed files with 13 additions and 13 deletions

View file

@ -503,15 +503,15 @@ fn sparse_matrix_operations() {
matrix.insert(2, 99);
matrix.insert(4, 0);
let mut disjoint: ChunkedBitSet<usize> = ChunkedBitSet::new_empty(100);
let mut disjoint: BitSet<usize> = BitSet::new_empty(100);
disjoint.insert(33);
let mut superset = ChunkedBitSet::new_empty(100);
let mut superset = BitSet::new_empty(100);
superset.insert(22);
superset.insert(75);
superset.insert(33);
let mut subset = ChunkedBitSet::new_empty(100);
let mut subset = BitSet::new_empty(100);
subset.insert(22);
// SparseBitMatrix::remove