Readit News logoReadit News
p403n1x87 commented on Austin 4 Released   github.com/P403n1x87/aust... · Posted by u/p403n1x87
p403n1x87 · a month ago
I am delighted to announce the 4.0 release of Austin. If you haven't heard of Austin before, it is an open-source out-of-process frame stack sampler for CPython, distributed under the GPLv3 license. It can be used to obtain statistical profiling data for a running Python application with no manual instrumentation and virtually zero impact on the runtime. You can find the code at

https://github.com/P403n1x87/austin

The main highlights of the new release are the support for Python 3.14, as well as many substantial performance improvements that make Austin one of the most accurate sampling profilers for CPython. More details about what's new and bug-fixes can be found in the changelog at

https://github.com/P403n1x87/austin/blob/master/ChangeLog

Installing Austin is as easy as running

pip install austin-dist

on any supported combination of architecture and platform. More installation options are available in the README file from the GitHub repository, along with usage details, as well as some examples of Austin in action. Details on how to contribute to Austin's development can be found at the bottom of the page.

As for ways of using Austin, the Austin VS Code extension provides a smooth interactive profiling experience, with interactive flame graphs straight into the text editor to allow you to quickly jump to the source code with a simple click. You can find the extension on the Visual Studio Marketplace and install it directly from VS Code:

https://marketplace.visualstudio.com/items?itemName=p403n1x8...

An Austin docker image, based on the latest Ubuntu image, is also available from Docker Hub:

https://hub.docker.com/r/p403n1x87/austin

Austin is a free and open-source project. A lot of effort goes into its development to ensure the best performance and that it stays up-to-date with the latest Python releases. If you find it useful, consider sponsoring this project on GitHub at https://github.com/sponsors/P403n1x87.

p403n1x87 commented on Austin 3.7 – Python frame stack sampler for CPython   github.com/P403n1x87/aust... · Posted by u/p403n1x87
p403n1x87 · a year ago
This latest release comes with support for CPython 3.13
p403n1x87 commented on Memray – A Memory Profiler for Python   github.com/bloomberg/memr... · Posted by u/softwaredoug
albertzeyer · 2 years ago
I collected a list of profilers (also memory profilers, also specifically for Python) here: https://github.com/albertz/wiki/blob/master/profiling.md

Currently I actually need a Python memory profiler, because I want to figure out whether there is some memory leak in my application (PyTorch based training script), and where exactly (in this case, it's not a problem of GPU memory, but CPU memory).

I tried Scalene (https://github.com/plasma-umass/scalene), which seems to be powerful, but somehow the output it gives me is not useful at all? It doesn't really give me a flamegraph, or a list of the top lines with memory allocations, but instead it gives me a listing of all source code lines, and prints some (very sparse) information on each line. So I need to search through that listing now by hand to find the spots? Maybe I just don't know how to use it properly.

I tried Memray, but first ran into an issue (https://github.com/bloomberg/memray/issues/212), but after using some workaround, it worked now. I get a flamegraph out, but it doesn't really seem accurate? After a while, there don't seem to be any new memory allocations at all anymore, and I don't quite trust that this is correct.

There is also Austin (https://github.com/P403n1x87/austin), which I also wanted to try (have not yet).

Somehow this experience so far was very disappointing.

Side node, I debugged some very strange memory allocation behavior of Python before, where all local variables were kept around after an exception, even though I made sure there is no reference anymore to the exception object, to the traceback, etc, and I even called frame.clear() for all frames to really clear it. It turns out, frame.f_locals will create another copy of all the local variables, and the exception object and all the locals in the other frame still stay alive until you access frame.f_locals again. At that point, it will sync the f_locals again with the real (fast) locals, and then it can finally free everything. It was quite annoying to find the source of this problem and to find workarounds for it. https://github.com/python/cpython/issues/113939

Another side node: Bloomberg has a couple of nice open source projects. E.g. I just realized, PyStack (https://bloomberg.github.io/pystack/) is also by Bloomberg.

p403n1x87 · 2 years ago
It is still in experimental stages, but would you be willing to test the memory mode of Echion? (https://github.com/P403n1x87/echion). It is essentially tracing of all memory allocations. Mind that, if an allocation is followed by a matching de-allocation, it won't be reported; so if you profile from start till end, and all the memory is released, the profile should be almost empty (in reality this will almost never be the case); this might explain why the data doesn't seem to make sense from the tools you have tried already (assuming they do a similar thing).
p403n1x87 commented on Spasmlang: Simple Python Assembly Language   github.com/P403n1x87/spas... · Posted by u/p403n1x87
rivepica · 2 years ago
What a tasteless joke of a project name.
p403n1x87 commented on Flameshow: A terminal flamegraph viewer   github.com/laixintao/flam... · Posted by u/todsacerdoti
p403n1x87 · 2 years ago
There is a "live" flamegraph TUI that uses Austin for those interested in Python profiling https://github.com/P403n1x87/austin-tui. The data collected can be exported and then converted into pprof, and analysed further with flameshow etc...

u/p403n1x87

KarmaCake day358December 21, 2019View Original