TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Building FunctionTrace, a graphical Python profiler

53 点作者 whocanfly将近 5 年前

3 条评论

JackC将近 5 年前
&quot;Having a Python C module gives significantly more power and performance, but comes with costs. it requires more code, it’s harder to find good documentation; and few features are easily accessible. While C modules appear to be an under-utilized tool for writing high performance Python modules (based on some FunctionTrace profiles I’ve seen), we’d recommend a balance. Write most of the non-performance critical code in Python and call into inner loops or setup code in C, for the pieces where Python doesn’t shine.&quot;<p>I&#x27;ve been wondering recently about the maintainability&#x2F;community aspect of C vs. pure-python packages. I was choosing between a pure-python simhash library and 5-times-as-fast library with a C++ core, and ultimately had to choose pure-python because the C++ one doesn&#x27;t have recent releases, can&#x27;t be reliably installed from source, and is harder for me to fix if it breaks. In other words it suffers from a lower bus facter, which I&#x27;d predict is generally true of Python packages with a fast non-Python core.<p>This got me wondering, what is the way to write a fast core for a Python package that is most ... likely to survive, I guess, once the original maintainer loses interest? Would it be some form of C (I think necessary in this case), Rust (once the tooling gels a little), lua, wasm, something else?
评论 #24177810 未加载
cynik_将近 5 年前
I wrote and open sourced something very similar recently: <a href="https:&#x2F;&#x2F;github.com&#x2F;kunalb&#x2F;panopticon" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;kunalb&#x2F;panopticon</a>. I don&#x27;t think it&#x27;s as sophisticated as function trace, but it generates chrome&#x2F;catapult compatible traces instead and has some additions for async coroutines&#x2F;generators.<p>Firefox&#x27;s profiler looks pretty cool, I wish it could also accept catapult traces as is -- it doesn&#x27;t seem to be the case. Now I know of:<p>- chrome:&#x2F;&#x2F;tracing - Firefox&#x27;s profiler - Perfetto: <a href="https:&#x2F;&#x2F;ui.perfetto.dev&#x2F;#!&#x2F;" rel="nofollow">https:&#x2F;&#x2F;ui.perfetto.dev&#x2F;#!&#x2F;</a> - Speedscope: <a href="https:&#x2F;&#x2F;www.speedscope.app&#x2F;" rel="nofollow">https:&#x2F;&#x2F;www.speedscope.app&#x2F;</a> - Brendan Gregg&#x27;s flamegraph generator<p>to help visualize traces. Are there other good ones?
person_of_color将近 5 年前
How does this compare to py-spy?