From 8116f6131a3ee3b4f2ce5f77477a84e434350e13 Mon Sep 17 00:00:00 2001 From: konsti Date: Sun, 4 Feb 2024 22:57:16 +0100 Subject: [PATCH] Document profiling and tracing-durations-export (#1234) Profiling is already extensively documented in ruff, so we can just link to that guide. I added `tracing-durations-export` to the guide because i found it a useful tool for optimizing. --- CONTRIBUTING.md | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 10aac8af3..437effed9 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -74,3 +74,19 @@ docker run --rm -it -v $(pwd):/app puffin-builder /app/target/x86_64-unknown-lin We recommend using this container if you don't trust the dependency tree of the package(s) you are trying to resolve or install. + +## Profiling + +Please refer to Ruff's [Profiling Guide](https://github.com/astral-sh/ruff/blob/main/CONTRIBUTING.md#profiling-projects), it applies to Puffin, too. + +### Analysing concurrency + +You can use [tracing-durations-export](https://github.com/konstin/tracing-durations-export) to visualize parallel requests and find any spots where Puffin is CPU-bound. Example usage, with `puffin` and `puffin-dev` respectively: + +```bash +RUST_LOG=puffin=info TRACING_DURATIONS_FILE=target/traces/jupyter.ndjson cargo run --features tracing-durations-export --profile profiling -- pip compile scripts/requirements/jupyter.in +``` + +```bash +RUST_LOG=puffin=info TRACING_DURATIONS_FILE=target/traces/jupyter.ndjson cargo run --features tracing-durations-export --bin puffin-dev --profile profiling -- resolve jupyter +```