add optional benchmarks
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 903e417..671aaa2 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -7,6 +7,8 @@
include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/mason.cmake)
option(WERROR "Add -Werror flag to build (turns warnings into errors)" ON)
+option(BENCHMARK_BIG_O "Calculate Big O in benchmark" OFF)
+option(BENCHMARK_100M "Run against 100M points" OFF)
# configure optimization
if (CMAKE_BUILD_TYPE STREQUAL "Debug")
@@ -50,6 +52,14 @@
find_package(Threads REQUIRED)
file(GLOB BENCH_SOURCES bench/*.cpp)
add_executable(bench-tests ${BENCH_SOURCES})
+if(BENCHMARK_BIG_O)
+ message("-- BENCHMARK_BIG_O=1")
+ target_compile_definitions(bench-tests PRIVAT BENCHMARK_BIG_O=1)
+endif()
+if(BENCHMARK_100M)
+ message("-- BENCHMARK_100M=1")
+ target_compile_definitions(bench-tests PRIVAT BENCHMARK_100M=1)
+endif()
#examples
add_executable(triangulate-geojson examples/triangulate_geojson.cpp)
diff --git a/bench/run.cpp b/bench/run.cpp
index 0106b71..2c9c592 100644
--- a/bench/run.cpp
+++ b/bench/run.cpp
@@ -32,10 +32,17 @@
while (state.KeepRunning()) {
delaunator::Delaunator delaunator(coords);
}
+ state.SetComplexityN(state.range(0));
}
BENCHMARK(BM_45K_geojson_nodes)->Unit(benchmark::kMillisecond);
BENCHMARK(BM_uniform)->Arg(2000)->Arg(100000)->Arg(200000)->Arg(500000)->Arg(1000000)->Unit(benchmark::kMillisecond);
-// BENCHMARK(BM_uniform)->Arg(1000000 * 100)->Unit(benchmark::kMillisecond);
+
+#if BENCHMARK_BIG_O
+ BENCHMARK(BM_uniform)->RangeMultiplier(2)->Range(1<<12, 1<<22)->Unit(benchmark::kMillisecond)->Complexity();
+#endif
+#if BENCHMARK_100M
+ BENCHMARK(BM_uniform)->Arg(1000000 * 100)->Unit(benchmark::kMillisecond);
+#endif
BENCHMARK_MAIN()