Share a Scalene report
Scalene is unusual among Python profilers because it separates Python time from native time line by line, and tracks memory alongside both. That distinction is the finding — "this line is slow" and "this line is slow inside numpy" lead to completely different fixes — and it is the first thing lost when the profile becomes a terminal screenshot.
The HTML output preserves it:
scalene --html --outfile profile.html --no-browser my_script.py
--no-browser matters if you are producing the file from a script or a CI job;
without it Scalene tries to open a viewer.
Publish it
Drag profile.html into the app, or POST it:
curl -fsS -X POST "https://commareports.com/api/v1/reports" \
-H "Authorization: Bearer $COMMA_API_TOKEN" \
-H "Content-Type: application/json" \
-d "$(jq -n --rawfile html profile.html \
--arg t "Scalene — feature build pipeline" '{title: $t, html: $html}')"
Report HTML renders with scripts enabled inside a sandboxed iframe
(allow-scripts, no allow-same-origin), so the reader gets the working
report: sortable columns, the per-line memory sparklines, and the
Python-versus-native split rendered in colour rather than described in a
caption.
Profile the region, not the program
A whole-program Scalene run on a long job produces a table nobody reads. Narrow it and the report becomes an argument:
from scalene import scalene_profiler
scalene_profiler.start()
build_feature_matrix(df)
scalene_profiler.stop()
Two practical flags for shareable output:
--cpu-only— skip memory instrumentation when the question is purely time. Much lower overhead, much smaller file.--reduced-profile— drop lines with negligible cost, so the published table is the lines a reader should actually look at.
From CI
Performance regressions land quietly. Profile the known-hot job and PATCH one report id per pipeline:
scalene --html --outfile profile.html --no-browser --reduced-profile \
-m pytest tests/test_pipeline.py
curl -fsS -X PATCH "https://commareports.com/api/v1/reports/$REPORT_ID" \
-H "Authorization: Bearer $COMMA_API_TOKEN" \
-H "Content-Type: application/json" \
-d "$(jq -n --rawfile html profile.html \
--arg t "Scalene — pipeline @ $GITHUB_SHA" '{title: $t, html: $html}')"
One URL per job, one revision per run. The revision list is the regression history you would otherwise be reconstructing from expired artifacts.
What review adds
- Anchored threads on the expensive line — see commenting on HTML.
- Revisions, so "this got worse in 4412" is checkable.
- Access per report — private, team, domain-gated or named reviewers. See the sharing model.
Limits
- Entry HTML: 5 MB.
--reduced-profileand--cpu-onlyare the two levers that keep a long run comfortably inside it. - 60 requests/minute per token.
Try it
Comma is free — unlimited reports, unlimited commenters, unlimited revision history.