Changelog¶
All notable changes between releases land here. Format roughly follows Keep a Changelog; entries are grouped under Added / Changed / Fixed / Removed.
Unreleased¶
Added¶
Profileris public API. The measurement engine — previously the internal_MonitoringProfiler— is now exported asProfilerand documented. Use it directly withstart()/stop(), as a context manager (with Profiler() as p:), or via the newprint_stats()convenience method.- Targeted profiling from Python.
profit(targets=[fn, ...])restricts measurement to the functions you name, mirroring the CLI's-p. - Documentation site built with Zensical and published on Read the Docs: a task guide per use case, CLI and Python API references, a Reading the output page, and terminal screenshots generated with shotty.
Changed¶
profitis now a factory.profit()returns aProfiler, replacing the oldwith profit as p:context-manager form. The@profitdecorator is unchanged. (breaking)profit runhides its own runpy launcher frames. The<frozen runpy>wrappers profit uses to execute your script no longer clutter the table, the same way it already omits its own profiler frames. Your script's actual imports are still shown — those are real startup cost, not harness.- Targeted runs ignore unrelated callables. When you profile specific functions,
profitno longer tracks everything else, cutting overhead and noise.
Fixed¶
- Cumulative time inflated by recursion. A recursive or otherwise re-entrant
function's wall time was added once per stack frame, so its
Totalcould come out many times larger than the whole script's runtime. Cumulative time is now counted once per top-level call. - Thread safety. Call stacks are now per-thread, so profiling code that spawns threads no longer mixes up timings and call counts.
- Exception timing. Functions that raise are now timed correctly — measurement uses
sys.monitoring'sPY_UNWINDevent instead ofRAISE, so timing isn't cut off at the raise point.
0.1.0 — 2026-05-01¶
Initial release.
Added¶
sys.monitoring-based profiler (Python 3.12+) that tracks both Python functions and C-extension calls, measuring cumulative wall time with low overhead.profit runto profile a script or module:-pto focus on specific functions,-bto compare against a baseline (adding a Delta column), and--sort/--limitto shape the table.profit timeitto profile a statement run in a loop, with--setupand an automatic or fixed (-n) iteration count.- Per-call statistics — calls, mean ± σ, min, max, total — with primitive-vs-
recursive call counts shown as
N/Pin the Calls column. @profitdecorator andprofitcontext manager for profiling directly from Python.