24 lines
628 B
C++
24 lines
628 B
C++
//
|
|
// Created by maximilian on 16.04.22.
|
|
//
|
|
|
|
#include <benchmark/benchmark.h>
|
|
|
|
#include "areas.h"
|
|
|
|
static void BM_area_computation(benchmark::State& state) {
|
|
std::vector<Rectangle> rects;
|
|
for (auto _ : state) {
|
|
state.PauseTiming();
|
|
rects = get_random_instance(state.range(0), state.range(1));
|
|
state.ResumeTiming();
|
|
get_area_union(rects);
|
|
}
|
|
state.SetComplexityN(state.range(0));
|
|
}
|
|
|
|
// add benchmark
|
|
BENCHMARK(BM_area_computation)->ArgsProduct({benchmark::CreateRange(1<<4,1<<24,4),{1<<20}})->Threads(8)->Complexity(benchmark::oNLogN);
|
|
|
|
// run benchmark as main()
|
|
BENCHMARK_MAIN();
|