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

科技回声

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

GitHubTwitter

首页

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

资源链接

HackerNews API原版 HackerNewsNext.js

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

Scalene: A high-performance, high-precision CPU, GPU, memory profiler for Python

183 点作者 kristianp7 个月前

10 条评论

infocollector7 个月前
I&#x27;ve used Scalene at various times in the past few years, and always liked using it when I want to dig deeper compared to cProfile&#x2F;profile. You might also want to look at:<p>1] <a href="https:&#x2F;&#x2F;github.com&#x2F;joerick&#x2F;pyinstrument">https:&#x2F;&#x2F;github.com&#x2F;joerick&#x2F;pyinstrument</a><p>2] <a href="https:&#x2F;&#x2F;github.com&#x2F;benfred&#x2F;py-spy">https:&#x2F;&#x2F;github.com&#x2F;benfred&#x2F;py-spy</a><p>3] <a href="https:&#x2F;&#x2F;github.com&#x2F;P403n1x87&#x2F;austin">https:&#x2F;&#x2F;github.com&#x2F;P403n1x87&#x2F;austin</a><p>4] <a href="https:&#x2F;&#x2F;github.com&#x2F;bloomberg&#x2F;memray">https:&#x2F;&#x2F;github.com&#x2F;bloomberg&#x2F;memray</a><p>5] <a href="https:&#x2F;&#x2F;github.com&#x2F;pyutils&#x2F;line_profiler">https:&#x2F;&#x2F;github.com&#x2F;pyutils&#x2F;line_profiler</a>
1st17 个月前
For profiling memory consider far more advanced memray.<p><a href="https:&#x2F;&#x2F;github.com&#x2F;bloomberg&#x2F;memray">https:&#x2F;&#x2F;github.com&#x2F;bloomberg&#x2F;memray</a>
codedokode7 个月前
In my experience, memory profilers that show line or function which allocated memory, are not very useful. What I usually want instead is to get a graph of all objects in memory with their size and path from root, to see who is using most memory. To see for example, that there is some cache or log that is never cleared.<p>For PHP and for browser&#x27;s developer tools there is such kind of profiler. But judging by screenshots, this profiler cannot produce such a graph. So its usability to solve memory leak&#x2F;high consumption issues is limited.<p>To summarize, what I usually need is not a line number, but a path to objects using&#x2F;holding most memory.
评论 #41915708 未加载
Loranubi7 个月前
Note: The Windows version currently only supports CPU and GPU profiling, but not memory or copy profiling.<p>That&#x27;s a problem with many of the profiling tools around Python. They often support Windows badly or not at all.
评论 #41911075 未加载
gloflo7 个月前
* with AI-powered optimization proposals<p>Sigh, why infest everything with &quot;AI&quot;.
kristianp7 个月前
This profiler was mentioned in the context of rewriting js tools in faster languages here:<p><a href="https:&#x2F;&#x2F;lobste.rs&#x2F;s&#x2F;ytjc8x&#x2F;why_i_m_skeptical_rewriting_javascript#c_9yf3tq" rel="nofollow">https:&#x2F;&#x2F;lobste.rs&#x2F;s&#x2F;ytjc8x&#x2F;why_i_m_skeptical_rewriting_javas...</a><p>The rewrite discussion is here: <a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=41898603">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=41898603</a>
评论 #41910286 未加载
enygmata7 个月前
It&#x27;s great for my side projects but I have never been able to use it at work. I gave up and used pyinstrument instead.<p>I wanted to submit a ticket for my use case but I can&#x27;t find a minimal program &amp; setup to reproduce the issue. I just know it in my gut it has to do with the mix of multiprocessing (fork) + async + threading.
motbus37 个月前
I used many times and sometimes I used py-spy. That helped me to improve several projects where people told me there were network problems but it was actually not
评论 #41914879 未加载
评论 #41915026 未加载
评论 #41913010 未加载
bbstats7 个月前
Anyone find the optimizer prompt(s)?
ancplrt7 个月前
If people wonder why there are so many tools for the slowest language on the planet:<p>In addition to being slow and unsuited for abstractions, people write horrible code with layers and layers of abstractions in Python. These tools can sometimes help with that.<p>People who do write streamlined code that necessarily uses C-extensions in Python will probably use cachegrind&#x2F;helgrind&#x2F;gprof etc.<p>Or switch to another language, which avoids many categories of other issues.
评论 #41913605 未加载
评论 #41912877 未加载