[benchmark-set] Split SetLookup into an ordered and random version
This commit is contained in:
parent
ae9c7b861b
commit
5f43ce825a
|
@ -74,7 +74,7 @@ BENCHMARK(BM_SetOrderedInsert_1000)
|
||||||
{2, 512}}); // Density
|
{2, 512}}); // Density
|
||||||
|
|
||||||
/* Single value lookup on sets of various sizes. */
|
/* Single value lookup on sets of various sizes. */
|
||||||
static void BM_SetLookup(benchmark::State& state) {
|
static void BM_SetLookup(benchmark::State& state, unsigned interval) {
|
||||||
unsigned set_size = state.range(0);
|
unsigned set_size = state.range(0);
|
||||||
unsigned max_value = state.range(0) * state.range(1);
|
unsigned max_value = state.range(0) * state.range(1);
|
||||||
|
|
||||||
|
@ -85,12 +85,16 @@ static void BM_SetLookup(benchmark::State& state) {
|
||||||
auto needle = max_value / 2;
|
auto needle = max_value / 2;
|
||||||
for (auto _ : state) {
|
for (auto _ : state) {
|
||||||
benchmark::DoNotOptimize(
|
benchmark::DoNotOptimize(
|
||||||
hb_set_has (original, needle++ % max_value));
|
hb_set_has (original, (needle += interval) % max_value));
|
||||||
}
|
}
|
||||||
|
|
||||||
hb_set_destroy(original);
|
hb_set_destroy(original);
|
||||||
}
|
}
|
||||||
BENCHMARK(BM_SetLookup)
|
BENCHMARK_CAPTURE(BM_SetLookup, ordered, 3)
|
||||||
|
->Ranges(
|
||||||
|
{{1 << 10, 1 << 16}, // Set Size
|
||||||
|
{2, 512}}); // Density
|
||||||
|
BENCHMARK_CAPTURE(BM_SetLookup, random, 12345)
|
||||||
->Ranges(
|
->Ranges(
|
||||||
{{1 << 10, 1 << 16}, // Set Size
|
{{1 << 10, 1 << 16}, // Set Size
|
||||||
{2, 512}}); // Density
|
{2, 512}}); // Density
|
||||||
|
|
Loading…
Reference in New Issue