1 hour ago · Tech · hide · 0 comments

Back in January, I introduced tprof, a targeting profiler for Python 3.12+ that measures the time spent in specific functions, rather than your whole program. As a reminder, here’s the basic usage, specifying a target function with -t and a script to run: $ tprof -t lib:maths ./example.py ... 🎯 tprof results: function calls total median ± σ min … max lib:maths() 2 610ms 305ms ± 2ms 304ms … 307ms Today, it’s my pleasure to announce tprof 1.3.0, a big release with the following changes. Way less overhead tprof previously stored each recorded call as a Python int inside a dict of lists, then used the statistics module to crunch the numbers at report time. These data structures were easy to write in an initial version and get the project going, but it added meaningful overhead to every monitored call. The new release replaces all of that with per-thread C structures: a stack of entry times and a flat array of durations per target, storing raw nanosecond int64_t values instead of boxed…

No comments yet. Log in to reply on the Fediverse. Comments will appear here.