用 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