Skip to content

Built-in profiler option and example optimisation

std::gregwar requested to merge stdgregwar/solarus:easy_profiler into dev

This leverage the use of easy_profiler and adds annotation to various functions that translate to precise timing measurements.

The function annotations allow to measure only critical parts of the engine and have very low overhead allowing it to stay into the release build.

Easy profiler comes with a GUI connecting to the server ran by the instrumentation in solarus and can record multiple frames of data and present them in flame graphs. It allows to quickly identify which part of the code took longer than needed/usual.

image

It also allows to monitor FPS while running.

This merge request includes an example of optimisation that was measured with the profiler : a complete rewrite of the quadtree code with a more cache-friendly memory layout and loose leaves as well as delayed cleanup/shrinking. (Inspired by this post)

The profiling is made optional in this Merge Request but we could imagine having the CI produce release builds with the instrumentation enabled by default. Allowing quest makers to see what is taking most of the time in their quests.

I also think this closes #1513 (closed).

Merge request reports

Loading