summaryrefslogtreecommitdiff
path: root/test/perf-geoData.cpp
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2024-01-01 17:56:26 +0000
committerDan Goodliffe <dan@randomdan.homeip.net>2024-01-01 17:56:26 +0000
commitd5cdbbf38380239524e351cb69aec94090884ca5 (patch)
tree5d7dff2f2775701069806eceb4eaef23b22eba3f /test/perf-geoData.cpp
parentReformat with new clang-format (diff)
parentRemove more use of legacy types (diff)
downloadilt-d5cdbbf38380239524e351cb69aec94090884ca5.tar.bz2
ilt-d5cdbbf38380239524e351cb69aec94090884ca5.tar.xz
ilt-d5cdbbf38380239524e351cb69aec94090884ca5.zip
Merge remote-tracking branch 'origin/terrain'
Diffstat (limited to 'test/perf-geoData.cpp')
-rw-r--r--test/perf-geoData.cpp42
1 files changed, 42 insertions, 0 deletions
diff --git a/test/perf-geoData.cpp b/test/perf-geoData.cpp
new file mode 100644
index 0000000..4d4505e
--- /dev/null
+++ b/test/perf-geoData.cpp
@@ -0,0 +1,42 @@
+#include <benchmark/benchmark.h>
+#include <game/geoData.h>
+
+namespace {
+ const GeoData tm {GeoData::loadFromAsciiGrid(FIXTURESDIR "height/SD19.asc")};
+
+ void
+ terrain_findPoint(benchmark::State & state)
+ {
+ for (auto _ : state) {
+ benchmark::DoNotOptimize(tm.findPoint({315555000, 495556000}));
+ }
+ }
+
+ void
+ terrain_walk(benchmark::State & state)
+ {
+ const glm::vec2 point {310001000, 490000000};
+ const GeoData::PointFace start {point, tm.findPoint(point)};
+ for (auto _ : state) {
+ tm.walk(start, {319999000, 500000000}, [](auto f) {
+ benchmark::DoNotOptimize(f);
+ });
+ }
+ }
+
+ void
+ terrain_walkBoundary(benchmark::State & state)
+ {
+ for (auto _ : state) {
+ tm.boundaryWalk([](auto heh) {
+ benchmark::DoNotOptimize(heh);
+ });
+ }
+ }
+}
+
+BENCHMARK(terrain_findPoint);
+BENCHMARK(terrain_walk);
+BENCHMARK(terrain_walkBoundary);
+
+BENCHMARK_MAIN();