From 582ac127f763f512c45f35e17b768487e3b51796 Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Sat, 4 Nov 2023 17:07:58 +0000 Subject: Rename TerrainMesh to GeoData to drop inplace --- test/perf-geoData.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 test/perf-geoData.cpp (limited to 'test/perf-geoData.cpp') diff --git a/test/perf-geoData.cpp b/test/perf-geoData.cpp new file mode 100644 index 0000000..e1546c1 --- /dev/null +++ b/test/perf-geoData.cpp @@ -0,0 +1,18 @@ +#include +#include + +namespace { + const GeoData tm {GeoData::loadFromAsciiGrid(FIXTURESDIR "height/SD19.asc")}; + + void + terrain_findPoint(benchmark::State & state) + { + for (auto _ : state) { + benchmark::DoNotOptimize(tm.findPoint({315555, 495556})); + } + } +} + +BENCHMARK(terrain_findPoint); + +BENCHMARK_MAIN(); -- cgit v1.2.3 From f53816a8fd9ec15ef03b5bf45472eda46e53c1ad Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Sat, 4 Nov 2023 21:05:35 +0000 Subject: Refactor to further simplify line/point operations Adds another perf test --- test/perf-geoData.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'test/perf-geoData.cpp') diff --git a/test/perf-geoData.cpp b/test/perf-geoData.cpp index e1546c1..2d79a90 100644 --- a/test/perf-geoData.cpp +++ b/test/perf-geoData.cpp @@ -11,8 +11,21 @@ namespace { benchmark::DoNotOptimize(tm.findPoint({315555, 495556})); } } + + void + terrain_walk(benchmark::State & state) + { + const glm::vec2 point {310001, 490000}; + const GeoData::PointFace start {point, tm.findPoint(point)}; + for (auto _ : state) { + tm.walk(start, {319999, 500000}, [](auto f) { + benchmark::DoNotOptimize(f); + }); + } + } } BENCHMARK(terrain_findPoint); +BENCHMARK(terrain_walk); BENCHMARK_MAIN(); -- cgit v1.2.3 From 04078dbb3fe4acd09d150e016c2b2e0d5d036950 Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Sun, 5 Nov 2023 13:07:32 +0000 Subject: Add methods to walk the boundary of the terrain mesh --- test/perf-geoData.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'test/perf-geoData.cpp') diff --git a/test/perf-geoData.cpp b/test/perf-geoData.cpp index 2d79a90..4fed632 100644 --- a/test/perf-geoData.cpp +++ b/test/perf-geoData.cpp @@ -23,9 +23,20 @@ namespace { }); } } + + 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(); -- cgit v1.2.3