Profiling web-edit with Python 3.15: flame graphs and source heatmaps
- ID
- 35066
- Status
- summarized
- Published
- 13 Oct 2026, 12:58 AM
- Fetched
- 14 Oct 2026, 7:14 AM
- Provider
- Simon Willison
- Category
- developer-ai
- Original URL
- https://simonwillison.net/2026/Oct/12/python-3-15-web-edit-profiling/
- Source URL
- https://simonwillison.net/atom/everything/
Summary
- Score
- 7.0
- Created
- 14 Oct 2026, 7:14 AM
- Tags
- Audience
- developersvibe_codersai_agent_users
What happened
Simon Willison profiled the unmodified web-edit app using Python 3.15's built-in `profiling.sampling`, with GPT-6 Astra Extra High in Codex asked to produce flame graph and source heatmap demos. The profile found mixed line-ending preservation dominated a busy editing workload: `preserve_endings` appeared in 64.8% of 15,296 recorded CPU stacks, and `SequenceMatcher.find_longest_match` contributed 38.3% of leaf samples. Sampling all threads was essential because 95.1% of stacks came from an AnyIO worker thread and would have been missed by a main-thread-only profile.
Why it matters
If you're profiling Python 3.15 async/AnyIO apps, sample all threads: a main-thread-only profile would have missed 95.1% of stacks in this run. For anyone building text editors or diff-heavy tools, the 64.8% `preserve_endings` share is a concrete prompt to benchmark mixed line-ending handling before optimizing other code. The Codex-generated flame graph/heatmap is a useful demo pattern, but treat agent output as a starting point for investigation.
Discussion angle
How much should builders trust agent-generated flame graphs and heatmaps when deciding what to optimize, and what checks would you add before acting on a 64.8% hotspot like `preserve_endings`?