Skip to content

Profiling

Ajishio ships a @aj.profile decorator. Apply it to your main() function and pass --profile on the command line to collect a cProfile run and save a .prof file to the current working directory (named after the project folder, e.g. platformer.prof):

@aj.profile
def main() -> None:
    aj.game_start()

main()
uv run demo_projects/platformer/main.py --profile

This prints a summary of the top 30 hotspots sorted by cumulative time. Without --profile the decorator is a no-op and adds zero overhead.

Visualising Results

snakeviz is included in the dev dependency group. Open a saved .prof file with:

uv run snakeviz platformer.prof

This starts a local web server and opens an interactive flame-graph in your browser. Press Ctrl-C to stop it.

Profiling is not supported on the web export.