Automatically instrumented python profiling.
env MAGICPROF=cpu.prof python <app.py># if MAGICPROF not set, profiling is not instrumented.# other options:# MAGICPROF_DISABLE_SUBCALLS # set to anything to disable subcalls. see cProfile.Profile.# MAGICPROF_DISABLE_BUILTINS # set to anything to disable subcalls. see cProfile.Profile.Use a tool like snakeviz to visualize the profile.
# e.g.
snakeviz cpu.prof# create python virtual environment
uv venv
uv pip install magicprof