跳到正文
Simon Willison·· 2 天前AI 评分42

使用 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 的性能分析显示,混合换行符保留是繁忙编辑负载中的主要开销。

正文

Research Profiling web-edit with Python 3.15: flame graphs and source heatmaps — Profiling the unmodified web-edit app with Python 3.15’s built-in `profiling.sampling` revealed that mixed line-ending preservation dominated a busy editing workload: `preserve_endings` appeared in 64.8% of 15,296 recorded CPU stacks, with `SequenceMatcher.find_longest_match` contributing 38.3% of leaf samples. Sampling all threads was essential, since 95.1% of stacks came from AnyIO’s worker thread and would have been missed by a main-thread-only profile.

I put the new Python 3.15 profiler through its paces by having GPT-6 Astra Extra High in Codex run it against my new web-edit app:

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

Here's the resulting example flame graph and heatmap.

来源:Simon Willison · simonwillison.net