Skip to content

Commit dbfbbe3

Browse files
committed
docs(readme): add the basic readme
1 parent d37641d commit dbfbbe3

File tree

1 file changed

+80
-0
lines changed

1 file changed

+80
-0
lines changed

README.md

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
## bitsvec
2+
3+
A bit vector with [the Rust standard library's portable SIMD API](https://github.com/rust-lang/portable-simd).
4+
5+
## How to use
6+
7+
```rust
8+
let mut bitvec = BitVec::ones(1000); // create a bitvec contains 0 ..= 999
9+
bitvec.set(900, false); // delete 900 from bitvec
10+
bitvec.set(1200, true); // add 1200 to bitvec (and expand bitvec to length 1201)
11+
let bitvec2 = BitVec::ones(1000);
12+
13+
let new_bitvec = bitvec.and_cloned(&bitvec2); // and operation, without consume
14+
let new_bitvec2 = bitvec & bitvec2; // and operation, consume both bitvec
15+
16+
// Operation Supported:
17+
// and, or, xor, not, eq, eq_left
18+
19+
assert_eq!(new_bitvec, new_bitvec2);
20+
```
21+
22+
## Performance
23+
24+
Compared on AMD Ryzen 9 5900hs, aginst:
25+
26+
* [bit\_vec 0.6.3](https://docs.rs/bit-vec/0.6.3/bit_vec/index.html)
27+
* [bitvec 1.0.0](https://docs.rs/bitvec/1.0.0/bitvec/index.html)
28+
29+
```
30+
$ cargo bench
31+
32+
bitsvec(this crate) time: [348.51 ns 348.74 ns 348.98 ns]
33+
Found 7 outliers among 100 measurements (7.00%)
34+
7 (7.00%) high mild
35+
36+
bitsvec_u16x8(this crate)
37+
time: [401.90 ns 403.02 ns 404.94 ns]
38+
Found 3 outliers among 100 measurements (3.00%)
39+
1 (1.00%) low mild
40+
2 (2.00%) high severe
41+
42+
bit-vec 0.6 time: [1.5891 us 1.5956 us 1.6034 us]
43+
Found 13 outliers among 100 measurements (13.00%)
44+
6 (6.00%) high mild
45+
7 (7.00%) high severe
46+
47+
bitvec 1.0 time: [32.228 us 32.516 us 32.821 us]
48+
Found 16 outliers among 100 measurements (16.00%)
49+
13 (13.00%) low severe
50+
3 (3.00%) high mild
51+
52+
bitsvec(this crate) with creation
53+
time: [884.09 ns 884.70 ns 885.35 ns]
54+
Found 6 outliers among 100 measurements (6.00%)
55+
2 (2.00%) high mild
56+
4 (4.00%) high severe
57+
58+
bitsvec_u16x8(this crate) with creation
59+
time: [878.66 ns 879.61 ns 880.66 ns]
60+
Found 4 outliers among 100 measurements (4.00%)
61+
3 (3.00%) high mild
62+
1 (1.00%) high severe
63+
64+
bit-vec 0.6 with creation
65+
time: [495.50 ns 495.87 ns 496.27 ns]
66+
Found 6 outliers among 100 measurements (6.00%)
67+
2 (2.00%) high mild
68+
4 (4.00%) high severe
69+
70+
bitvec 1.0 with creation
71+
time: [29.003 us 29.028 us 29.058 us]
72+
Found 15 outliers among 100 measurements (15.00%)
73+
5 (5.00%) low severe
74+
8 (8.00%) high mild
75+
2 (2.00%) high severe
76+
```
77+
78+
## Credits
79+
80+
Most code of this crate is from (https://github.com/GCCFeli/bitvec_simd). On top of that, some changes were made.

0 commit comments

Comments
 (0)