[benchmark-set] Reduce lookup benchmark overhead

Turnsout 90% was overhead...  Now lookup is in the 4ns ballpark.
This commit is contained in:
Behdad Esfahbod 2022-04-29 12:23:53 -06:00
parent 4de5352a3d
commit dd005911b9
1 changed files with 2 additions and 1 deletions

View File

@ -82,9 +82,10 @@ static void BM_SetLookup(benchmark::State& state) {
RandomSet(set_size, max_value, original);
assert(hb_set_get_population(original) == set_size);
auto needle = max_value / 2;
for (auto _ : state) {
benchmark::DoNotOptimize(
hb_set_has (original, rand() % max_value));
hb_set_has (original, needle));
}
hb_set_destroy(original);