Urgent.News

What's breaking now, across thousands of outlets.

Tech

The State of Python Profiling in 2026

In 2026, the state of Python profiling has undergone significant advancements. CPython now includes its own sampling profiler by default, while free-threaded builds have transitioned from experimental to mainstream deployment. Additionally, coding agents have begun utilizing profile data for their analyses.

When comparing profiling tools, two primary approaches emerge: tracing and sampling. Tracing profilers, such as cProfile, record every function call and return, providing precise call counts but introducing overhead that alters the program's timing. In contrast, sampling profilers analyze the call stack at regular intervals, constructing a statistical representation of the program's behavior. Sampling profilers, like Austin, py-spy, and Tachyon, enable the program to run at near-normal speed without sacrificing accuracy.

Furthermore, profiling tools can operate either in-process or out-of-process. In-process profilers integrate with the target program, either by initiating it or being imported. Conversely, out-of-process profilers are separate applications that read the target's memory without requiring any modifications. Each of the tools discussed in this article employs the sampling methodology and operates as an out-of-process profiler.

Accuracy and overhead are critical factors when evaluating profiling tools. A thorough comparison of various Python profilers conducted by the Scalene team at UMass Amherst concluded that sampling profilers are both more efficient and often more accurate than tracing profilers. Austin, py-spy, and Scalene, which are all sampling profilers, demonstrated minimal overhead, adding between 0% and 2% to the runtime, compared to cProfile's 73% and some other profilers' over 200%.

Although Tachyon is a relatively new profiler, it is now the default choice for Python profiling, making it an essential tool to consider. However, pyflame, an earlier sampling profiler from 2016, is notably absent from this analysis due to its Linux-only compatibility and lack of maintenance following Python 3.8's release.

Written by urgent.news from Lobsters's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.

Read the original at p403n1x87.github.io →

More in Tech

More from Thursday 5 November →