Simon Willison·· 1 天前AI 评分29
用 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%。
正文 · AI 翻译
研究 使用 Python 3.15 分析 web-edit:火焰图与源码热力图 — 使用 Python 3.15 内置的 `profiling.sampling` 对未经修改的 web-edit 应用进行性能分析后发现,混合换行符保留在繁忙的编辑工作负载中占据主导:`preserve_endings` 出现在 15,296 条已记录 CPU 栈的 64.8% 中,`SequenceMatcher.find_longest_match` 贡献了叶子样本的 38.3%。对所有线程进行采样至关重要,因为 95.1% 的栈来自 AnyIO 的工作线程,若仅分析主线程则会将其遗漏。
我对新的 Python 3.15 性能分析器进行了充分考验,方法是让 Codex 中的 GPT-6 Astra Extra High 把它运行在我的新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