Vibeleaderboard
← All Intel
Intel / article

Profiling web-edit with Python 3.15: flame graphs and source heatmaps

Source
simonwillison.net
Date

Context

Profiling only the main thread would have missed almost all the recorded CPU activity in Simon Willison's web-edit experiment. Using Python 3.15's sampling profiler, he reports that 95.1% of the captured execution snapshots came from a background worker thread. Preserving mixed newline formats appeared in 64.8% of all recorded stacks, identifying a concrete place to investigate the editing workload's cost. Experiment report.

The result is a diagnosis of the unmodified . Sampling every thread exposed work that a narrower measurement would have overlooked; the report does not measure a speedup from changing that code. Profiling findings.

Key takeaways · AI-distilled
  • Simon Willison had GPT-6 Astra in Codex run Python 3.15's built-in profiling.sampling module against his web-edit app, producing a flame graph and a source heatmap.
  • 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 accounted for 38.3% of leaf samples.
  • 95.1% of stacks came from AnyIO's worker thread, so a profile that sampled only the main thread would have missed the hotspot.
Terms in this piece · Glossary
  • Application — Software arranged so that a person can use it; in this course, the software around a model that accepts your request, prepares the context and shows the reply.
  • Agent — A system in which a model repeatedly chooses operations, a harness carries them out, and the results return to the model to inform its next choice.
  • Function — A named block of instructions that takes inputs, called arguments, and hands back a result, called its return value.

Get the Brief

A cited digest of what matters for people building with AI, every morning. Unsubscribe anytime. See today’s edition

Read the source simonwillison.net
Recommended reads