Skip to content

Commit

Permalink
dun_render_benchmark: BM_RenderBlackTile
Browse files Browse the repository at this point in the history
```bash
tools/build_and_run_benchmark.py dun_render_benchmark -- \
  --benchmark_filter='.*BlackTile.*' \
  --benchmark_repetitions=10 \
  --benchmark_display_aggregates_only
```

```
------------------------------------------------------------------------------------
Benchmark                          Time             CPU   Iterations UserCounters...
------------------------------------------------------------------------------------
BM_RenderBlackTile_mean          157 ns          157 ns           10 items_per_second=6.37889M/s
BM_RenderBlackTile_median        157 ns          157 ns           10 items_per_second=6.38348M/s
BM_RenderBlackTile_stddev      0.490 ns        0.487 ns           10 items_per_second=19.8345k/s
BM_RenderBlackTile_cv           0.31 %          0.31 %            10 items_per_second=0.31%
```

I have a very surprising finding in a follow-up PR...
  • Loading branch information
glebm committed Aug 20, 2024
1 parent 15f8987 commit 49f63c5
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions test/dun_render_benchmark.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -112,5 +112,20 @@ DEFINE_FOR_TILE_TYPE(Square)
DEFINE_FOR_TILE_TYPE(LeftTrapezoid)
DEFINE_FOR_TILE_TYPE(RightTrapezoid)

void BM_RenderBlackTile(benchmark::State &state)
{
InitOnce();
Surface out = Surface(SdlSurface.get());
size_t numItemsProcessed = 0;
for (auto _ : state) {
world_draw_black_tile(out, 320, 240);
uint8_t color = out[Point { 310, 200 }];
benchmark::DoNotOptimize(color);
++numItemsProcessed;
}
state.SetItemsProcessed(numItemsProcessed);
}
BENCHMARK(BM_RenderBlackTile);

} // namespace
} // namespace devilution

0 comments on commit 49f63c5

Please sign in to comment.