TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Building FunctionTrace, a graphical Python profiler

53 pointsby whocanflyalmost 5 years ago

3 comments

JackCalmost 5 years ago
&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_almost 5 years ago
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_coloralmost 5 years ago
How does this compare to py-spy?