From b18118130d016222e46c598fce2bea978a474f02 Mon Sep 17 00:00:00 2001 From: "W. Evan Sheehan" Date: Fri, 17 Nov 2023 14:25:34 -0700 Subject: [PATCH] Add profiling instructions to CONTRIBUTING --- CONTRIBUTING.md | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index d49718f8..5b0487c7 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -67,7 +67,29 @@ service is as simple as: npm run vendor && npm run build npm run lint npm run format + +## Profiling + +If you need to do some performance profiling you can run the debug server with +`FLASK_PROFILE=True`. You’ll need to first create a directory for the profile +files: + ``` +mkdir -p tmp/profiler +FLASK_PROFILE=True poetry run flask run --debug +``` + +There are multiple ways you can view the `.prof` files generated by the +profiling middleware. One easy way to view them is with snakeviz. + +``` +poetry run pip install snakeviz +poetry run snakeviz tmp/profiler/.prof +``` + +That first line installs snakeviz in your virtual env (without adding it as a +dependency to the project) and the second will load a performance profile into +your default browser for you to view. ## Coding Style