Skip to content

Commit e6de444

Browse files
committed
Add CPU info used for benchmarks
1 parent fe3452e commit e6de444

File tree

1 file changed

+50
-4
lines changed

1 file changed

+50
-4
lines changed

README.md

Lines changed: 50 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,59 @@ This repository provides a small bit vector implementation along with tests and
44

55
## Running the benchmarks without bounds checking
66

7-
Bounds checking is enabled by default. To benchmark without checks, configure
8-
and build with (this defines `BITVECTOR_NO_BOUND_CHECK`). The build system now
9-
detects whether the compiler and host CPU support AVX2 or other native
10-
instructions and enables them when possible:
7+
Bounds checking is enabled by default. To benchmark without checks, configure and build with (this defines `BITVECTOR_NO_BOUND_CHECK`). The build system now detects whether the compiler and host CPU support AVX2 or other native instructions and enables them when possible:
118

129
```bash
1310
cmake -S . -B build -DBITVECTOR_NO_BOUND_CHECK=ON -DCMAKE_BUILD_TYPE=Release
1411
cmake --build build --config Release
1512
./build/bitvector_benchmark
1613
```
14+
15+
## GitHub Actions Benchmark Results
16+
17+
The following table shows benchmark times from the latest CI run. Each test was executed with `1<<20` bits.
18+
19+
| Benchmark | Time (ns) |
20+
|-----------|-----------|
21+
| BM_Bowen_Set | 1826751 |
22+
| BM_Std_Set | 2975545 |
23+
| BM_Bowen_PushBack | 1998142 |
24+
| BM_Std_PushBack | 2990558 |
25+
| BM_Bowen_Access | 984200 |
26+
| BM_Std_Access | 2257978 |
27+
| BM_Bowen_SetBit | 2123333 |
28+
| BM_Std_SetBit | 2740340 |
29+
| BM_Bowen_SetBitTrueUnsafe | 1992765 |
30+
| BM_Std_SetBitTrueUnsafe | 2558438 |
31+
| BM_Bowen_SetBitTrue6 | 1545274 |
32+
| BM_Std_SetBitTrue6 | 2601283 |
33+
| BM_Bowen_QSetBitTrue6V2 | 2248553 |
34+
| BM_Std_QSetBitTrue6 | 3133552 |
35+
| BM_Bowen_IncrementUntilZero | 34849 |
36+
| BM_Std_IncrementUntilZero | 1941798 |
37+
38+
`BM_Bowen_IncrementUntilZero` is the fastest benchmark, showing a substantial improvement over the standard approach.
39+
40+
## Using `incrementUntilZero`
41+
42+
`incrementUntilZero` scans the bit vector starting at the given position until it reaches the first zero bit. The position is updated in place:
43+
44+
```cpp
45+
bitvector<> bv(1024, true);
46+
bv.set_bit(1023, false); // ensure there is a zero bit
47+
size_t pos = 0;
48+
bv.incrementUntilZero(pos);
49+
// `pos` now holds the index of the first zero bit
50+
```
51+
52+
53+
## CPU Info
54+
55+
The benchmarks above were run on the following machine:
56+
57+
```
58+
Architecture: x86_64
59+
CPU(s): 5
60+
Model name: Intel(R) Xeon(R) Platinum 8272CL CPU @ 2.60GHz
61+
```
62+

0 commit comments

Comments
 (0)