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.

Memray: a memory profiler for Python

495 pointsby shchekleinabout 3 years ago

12 comments

shchekleinabout 3 years ago
A twitter thread with some screenshots and details - <a href="https:&#x2F;&#x2F;twitter.com&#x2F;1st1&#x2F;status&#x2F;1516859294896906241" rel="nofollow">https:&#x2F;&#x2F;twitter.com&#x2F;1st1&#x2F;status&#x2F;1516859294896906241</a>
itamarstabout 3 years ago
I&#x27;m excited to see more profiling tools for Python!<p>This sounds like it does peak memory, which is critical for batch jobs, since that&#x27;s the bottleneck. Memory is fundamentally different than performance in that it&#x27;s a limited resource, instead of cumulative cost; making any part of the program faster almost always helps speed up the program (at least a little, or at least reduces CPU load), but optimizing non-peak memory has no impact. You have to be able to identify the peak in order to reduce memory usage.<p>If you want peak memory profiling for Python that also runs on macOS, check out <a href="https:&#x2F;&#x2F;pythonspeed.com&#x2F;fil&#x2F;" rel="nofollow">https:&#x2F;&#x2F;pythonspeed.com&#x2F;fil&#x2F;</a> (ARM support has some issues, but once I unpack my new Mac Mini I plan to fix it.)<p>Ways memray is better than Fil:<p>- Native callstacks.<p>- More kinds of reports, and ability to do custom post-processing of data.<p>- Much lower overhead (but not always, see reply).<p>- Subprocess support.<p>Fil I suspect has better flamegraphs: <a href="https:&#x2F;&#x2F;pythonspeed.com&#x2F;articles&#x2F;a-better-flamegraph&#x2F;" rel="nofollow">https:&#x2F;&#x2F;pythonspeed.com&#x2F;articles&#x2F;a-better-flamegraph&#x2F;</a><p>And if you&#x27;re running Python batch jobs, and want both peak memory and performance profiling in production, check out Sciagraph: <a href="https:&#x2F;&#x2F;pythonspeed.com&#x2F;sciagraph&#x2F;" rel="nofollow">https:&#x2F;&#x2F;pythonspeed.com&#x2F;sciagraph&#x2F;</a><p>(You can probably cobble together something like Sciagraph with py-spy + memray, but you won&#x27;t e.g. get timeline reports designed with batch jobs in mind.)
评论 #31104447 未加载
评论 #31104251 未加载
评论 #31105419 未加载
评论 #31105437 未加载
noitpmederabout 3 years ago
Want to chime in to say it&#x27;s awesome that Bloomberg is releasing this product to the world. I don&#x27;t think many financial organizations would even consider releasing anything as open source, even if it is as general purpose as this tool. My current one (HFT,MM) wouldn&#x27;t go for it.<p>It also shows good engineering practices. I&#x27;d venture a guess that they are probably one of the better ones in the space.<p>Makes me want to work there! Maybe one day...
评论 #31109655 未加载
评论 #31106575 未加载
评论 #31130658 未加载
评论 #31108168 未加载
uniqueuidabout 3 years ago
Tangential question: Does anybody have a good recommendation for a profiler that works well with massively async codebases?<p>My experience has been that the concurrent nature of coroutines can make it hard to reason about what&#x27;s going on at a particular point in time. If you don&#x27;t know how many things you&#x27;re awaiting on at a specific moment (and what potential external stuff they may be interacting with), it&#x27;s not exactly easy to identify memory usage of codepaths.
评论 #31102891 未加载
评论 #31104122 未加载
评论 #31103361 未加载
评论 #31102902 未加载
评论 #31109285 未加载
polskibusabout 3 years ago
Can I plug it into existing airflow instance and check all the dags somehow? If not , what would be the easiest way to profile each dag?
nevesabout 3 years ago
I&#x27;ve just put in production an app that intermittently can&#x27;t allocate enough memory. Is this the best tool to debug it? I&#x27;ve never had to debug memory problems in Python.
评论 #31105557 未加载
评论 #31104265 未加载
评论 #31105596 未加载
评论 #31104321 未加载
评论 #31105381 未加载
anonuabout 3 years ago
Interesting that this comes from Bloomberg.
评论 #31108568 未加载
p403n1x87about 3 years ago
Hmm some elements of that TUI look vaguely familiar ... where have I seen them before?
user1713952about 3 years ago
Really impressive feature set! I just wish it could run on windows too.
评论 #31110487 未加载
ewuhicabout 3 years ago
Could anyone suggest a similar quality CPU load python profiler?
kristianpaulabout 3 years ago
This is awesome. Is there is something like this for Ruby?
isaacfrondabout 3 years ago
If you need this, why are you using Python? Seriously, can anyone explain that to me?
评论 #31107091 未加载
评论 #31107452 未加载
评论 #31108433 未加载
评论 #31108555 未加载
评论 #31107223 未加载