跳到正文
原文
Simon Willison·· 3 天前AI 评分38

用 Python 3.15 性能分析 web-edit:火焰图与源码热力图

Profiling web-edit with Python 3.15: flame graphs and source heatmaps

AI 导读

用 Python 3.15 内置的 `profiling.sampling` 分析未修改的 web-edit 应用,发现混合换行符保留主导了繁忙的编辑负载:`preserve_endings` 出现在 15,296 个已记录 CPU 栈中的 64.8%,`SequenceMatcher.find_longest_match` 占叶子样本的 38.3%。

正文 · AI 翻译

研究 使用 Python 3.15 分析 web-edit:火焰图与源码热力图 —— 使用 Python 3.15 内置的 `profiling.sampling` 对未经修改的 web-edit 应用进行分析后发现,混合换行符保留在繁忙的编辑工作负载中占据主导地位:在记录的 15,296 个 CPU 栈中,`preserve_endings` 出现在 64.8% 的栈中,而 `SequenceMatcher.find_longest_match` 贡献了 38.3% 的叶子样本。对所有线程采样至关重要,因为 95.1% 的栈来自 AnyIO 的工作线程,若仅分析主线程则会遗漏这些栈。

我让 Codex 中的 GPT-6 Astra Extra High 运行 新的 Python 3.15 分析器,对我新的 web-edit 应用进行测试:

I need a Python 3.15 flame graph and heatmap demo of the "web-edit" app from PyPI - research first then make me those demos

这是生成的示例 火焰图和 热力图。

来源:Simon Willison · simonwillison.net