[HN Gopher] FunctionTrace: Graphical Python Profiler ___________________________________________________________________ FunctionTrace: Graphical Python Profiler Author : alex_hirner Score : 66 points Date : 2023-07-05 19:22 UTC (3 hours ago) (HTM) web link (functiontrace.com) (TXT) w3m dump (functiontrace.com) | BeefySwain wrote: | If I'm understanding this correctly you need to use Cargo to | install part of this. That makes it a lot harder to start using | as someone in the Python ecosystem (who is not also in the Rust | ecosystem) | tempest_ wrote: | Python packaging is painful. | | They will probably get a build system going so wheels can be | used eventually. | MistaIA wrote: | How about Jupiter Notebooks? | jzelinskie wrote: | Whatever happened to scalene? | TkTech wrote: | Nothing at all, I was using it just fine earlier today :) | not-my-account wrote: | Functiontrace is very good! I've used it a lot for hammering down | bottlenecks, and it is easy to drop in to a script | megaserg wrote: | Looks like it supports native stack as well, great! Most | bottlenecks in seriously performance-sensitive programs are in | the native code, which makes built-in tools like cProfile hardly | useful. | kapilvt wrote: | https://github.com/benfred/py-spy is also really nice, and has an | actual oss license. | Dork1234 wrote: | Is this something that could be made to work with MicroPython? | teh_matt wrote: | Most of the work is done via a C extension, which I suspect | would be incompatible with MicroPython. The same techniques are | presumably applicable, depending on how many interesting hooks | MicroPython exposes. | scottwick wrote: | Is there something about the actual profiler that differs from | existing tools like pyinstrument [1] or py-spy [2]? I know | pyinstrument has various output options and I wonder if it could | potentially output something readable by the Firefox Profiler | tool. | | [1] : https://github.com/joerick/pyinstrument [2] : | https://github.com/benfred/py-spy | Veserv wrote: | It uses FEE (function entry/exit) tracing so it generates a | full execution trace of all functions called during your run | like "History" [1], the C/C++ tracing profiler it was based on. | | You can then post-process that trivially to get low resolution | aggregate information like normal statistical/sampling | profilers generate. | | [1] https://www.ghs.com/products/MULTI_IDE.html | kapilvt wrote: | compare to pyspy, which is out of process and reads process | memory to reconstruct stack frames as a sampler, which means | marginal overhead for the program, re safer to use in prod. | it would be interesting to see a function entry/exit on linux | via epbf attached to USDT. | Veserv wrote: | They claim tracing overhead is <10%. This is very | believable, and actually frankly seems kind of high. You | can do a full execution trace of a C program for a similar | low double digit percent overhead and Python is usually on | the order of 10x slower, so naively you would assume like | 1% overhead. | | I assume the hooks Python makes available are probably just | kind of bad for this use case and they do not have access | to a proper high speed log. | teh_matt wrote: | Yeah, it tends to be low single digit percents, but you | can get some pessimal behavior if you have enough tiny | functions because the overhead of what Cpython exposes | starts becoming large. Our "benchmark" where the 10% | comes from is tensorflow, which is overwhelmingly tiny | functions and no sustained io/individual functions. | RockRobotRock wrote: | looks great. wish jetbrains implemented this | kijeda wrote: | The license is a bit perplexing at | https://gitlab.com/mbryant/functiontrace/-/blob/master/LICEN... | | It says it is licensed under Apache License 2.0, but also under | "Prosperity Public License 3.0.0" which limits use for a | commercial purpose to 30 days. | teh_matt wrote: | I'm not sure why the Gitlab UI shows Apache 2.0, but PPL3.0 is | the correct license (and is in LICENSE.md). | xg15 wrote: | I don't see any pricing page or anything. So if I'm a business | and after the 30 days decide I'm sold on it, what exactly do I | do? | zorgmonkey wrote: | The website (https://functiontrace.com/) mentions that dual | licensing is available at the bottom of the page, so my best | guess would be that you need to contact the author for | pricing details. | xg15 wrote: | ah, that makes sense. Thanks! | dang wrote: | Related: | | _Building FunctionTrace, a graphical Python profiler_ - | https://news.ycombinator.com/item?id=24175395 - Aug 2020 (4 | comments) | bgirard wrote: | It's really cool to see the Firefox Profiler UI reused in new | projects. I'm biased having worked on it, but it's a very | powerful visualization tool for complex multi-threaded | performance data. ___________________________________________________________________ (page generated 2023-07-05 23:00 UTC)