@@ -76,6 +76,50 @@ static void BM_Std_Access(benchmark::State& state) {
7676 }
7777}
7878
79+ static void BM_Bowen_SetBit (benchmark::State& state) {
80+ size_t n = state.range (0 );
81+ for (auto _ : state) {
82+ bitvector<> bv (n);
83+ for (size_t i=0 ;i<n;++i) {
84+ bv.set_bit (i, static_cast <bool >(i & 1 ));
85+ }
86+ benchmark::ClobberMemory ();
87+ }
88+ }
89+
90+ static void BM_Std_SetBit (benchmark::State& state) {
91+ size_t n = state.range (0 );
92+ for (auto _ : state) {
93+ std::vector<bool > bv (n);
94+ for (size_t i=0 ;i<n;++i) {
95+ bv[i] = static_cast <bool >(i & 1 );
96+ }
97+ benchmark::ClobberMemory ();
98+ }
99+ }
100+
101+ static void BM_Bowen_SetBitTrueUnsafe (benchmark::State& state) {
102+ size_t n = state.range (0 );
103+ for (auto _ : state) {
104+ bitvector<> bv (n);
105+ for (size_t i=0 ;i<n;++i) {
106+ bv.set_bit_true_unsafe (i);
107+ }
108+ benchmark::ClobberMemory ();
109+ }
110+ }
111+
112+ static void BM_Std_SetBitTrueUnsafe (benchmark::State& state) {
113+ size_t n = state.range (0 );
114+ for (auto _ : state) {
115+ std::vector<bool > bv (n);
116+ for (size_t i=0 ;i<n;++i) {
117+ bv[i] = true ;
118+ }
119+ benchmark::ClobberMemory ();
120+ }
121+ }
122+
79123
80124static void BM_Bowen_SetBitTrue6 (benchmark::State& state) {
81125 size_t n = state.range (0 );
@@ -153,6 +197,10 @@ BENCHMARK(BM_Bowen_PushBack)->Arg(1<<20)->MinTime(BITVECTOR_BENCHMARK_MIN_TIME);
153197BENCHMARK (BM_Std_PushBack)->Arg(1 <<20 )->MinTime(BITVECTOR_BENCHMARK_MIN_TIME);
154198BENCHMARK (BM_Bowen_Access)->Arg(1 <<20 )->MinTime(BITVECTOR_BENCHMARK_MIN_TIME);
155199BENCHMARK (BM_Std_Access)->Arg(1 <<20 )->MinTime(BITVECTOR_BENCHMARK_MIN_TIME);
200+ BENCHMARK (BM_Bowen_SetBit)->Arg(1 <<20 )->MinTime(BITVECTOR_BENCHMARK_MIN_TIME);
201+ BENCHMARK (BM_Std_SetBit)->Arg(1 <<20 )->MinTime(BITVECTOR_BENCHMARK_MIN_TIME);
202+ BENCHMARK (BM_Bowen_SetBitTrueUnsafe)->Arg(1 <<20 )->MinTime(BITVECTOR_BENCHMARK_MIN_TIME);
203+ BENCHMARK (BM_Std_SetBitTrueUnsafe)->Arg(1 <<20 )->MinTime(BITVECTOR_BENCHMARK_MIN_TIME);
156204BENCHMARK (BM_Bowen_SetBitTrue6)->Arg(1 <<20 )->MinTime(BITVECTOR_BENCHMARK_MIN_TIME);
157205BENCHMARK (BM_Std_SetBitTrue6)->Arg(1 <<20 )->MinTime(BITVECTOR_BENCHMARK_MIN_TIME);
158206BENCHMARK (BM_Bowen_QSetBitTrue6V2)->Arg(1 <<20 )->MinTime(BITVECTOR_BENCHMARK_MIN_TIME);
0 commit comments