跳到正文
原文
Simon Willison·· 2026-10-13AI 评分30

使用 Python 3.15 的 `profiling.sampling` 剖析 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%,且 95.1% 的堆栈来自 AnyIO 工作线程,验证了全线程采样的必要性。

来源:Simon Willison · simonwillison.net