You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
26 lines
498 B
26 lines
498 B
|
2 years ago
|
#include <benchmark/benchmark.h>
|
||
|
|
|
||
|
|
#include "crawl.hpp"
|
||
|
|
#include "engine/displacement.hpp"
|
||
|
|
|
||
|
|
namespace devilution {
|
||
|
|
namespace {
|
||
|
|
|
||
|
|
void BM_Crawl(benchmark::State &state)
|
||
|
|
{
|
||
|
|
const int radius = state.range(0);
|
||
|
|
for (auto _ : state) {
|
||
|
|
int sum;
|
||
|
|
Crawl(0, radius, [&sum](Displacement d) {
|
||
|
|
sum += d.deltaX + d.deltaY;
|
||
|
|
return false;
|
||
|
|
});
|
||
|
|
benchmark::DoNotOptimize(sum);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
BENCHMARK(BM_Crawl)->RangeMultiplier(4)->Range(1, 20);
|
||
|
|
|
||
|
|
} // namespace
|
||
|
|
} // namespace devilution
|