summaryrefslogtreecommitdiff
path: root/test/perf-geoData.cpp
blob: 2d79a908c59f46360b4dade4a36f1125396636d0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#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({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();