]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
gh-138122: Add differential flame graph (#145785)
authorivonastojanovic <80911834+ivonastojanovic@users.noreply.github.com>
Mon, 30 Mar 2026 11:31:06 +0000 (12:31 +0100)
committerGitHub <noreply@github.com>
Mon, 30 Mar 2026 11:31:06 +0000 (12:31 +0100)
commitf4d3c61f36776db6847834ec3577d7a53a5757d8
treec27cbd2db0ac19949625fc6ec6977557689fda7d
parent6857de625f1ab256c0ce48d9c8280d678d61bab1
gh-138122: Add differential flame graph (#145785)

Differential flame graphs compare two profiling runs and highlight where
performance has changed. This makes it easier to detect regressions
introduced by code changes and to verify that optimizations have the
intended effect.

The visualization renders the current profile with frame widths
representing current time consumption. Color is then applied to show the
difference relative to the baseline profile: red gradients indicate
regressions, while blue gradients indicate improvements.

Some call paths may disappear entirely between profiles. These are
referred to as elided stacks and occur when optimizations remove code
paths or when certain branches stop executing. When elided stacks are
present, an "Elided" toggle is displayed, allowing the user to switch
between the main differential view and a view showing only the removed
paths.

Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
Doc/library/profiling.sampling.rst
Lib/profiling/sampling/_flamegraph_assets/flamegraph.css
Lib/profiling/sampling/_flamegraph_assets/flamegraph.js
Lib/profiling/sampling/_flamegraph_assets/flamegraph_template.html
Lib/profiling/sampling/cli.py
Lib/profiling/sampling/stack_collector.py
Lib/test/test_profiling/test_sampling_profiler/mocks.py
Lib/test/test_profiling/test_sampling_profiler/test_collectors.py
Misc/NEWS.d/next/Library/2026-03-10-19-50-59.gh-issue-138122.CsoBEo.rst [new file with mode: 0644]