# Python 3.15’s profiler finds line-ending code dominates web-edit app

Digest AI · Research · published 2026-10-12T16:58:00Z

Canonical: https://digestai.news/story/python-3-15s-profiler-finds-line-ending-code-dominates-web-edit-app

## Summary

Simon Willison profiled a Python 3.15 web-edit app using built-in sampling tools. The app’s `preserve_endings` feature consumed 64.8% of CPU time across 15,296 recorded stacks, with `SequenceMatcher.find_longest_match` accounting for 38.3% of leaf samples. Sampling all threads was critical, as 95.1% of stacks originated from AnyIO’s worker thread, which would have been missed by profiling only the main thread.

Willison also used GPT-6 Astra Extra High in Codex to generate flame graphs and heatmaps for the app. The results highlight inefficiencies in line-ending handling, suggesting potential optimizations for the web-edit workflow.

## Key points

- Python 3.15’s profiler shows `preserve_endings` uses 64.8% of CPU in web-edit app
- `SequenceMatcher.find_longest_match` takes 38.3% of leaf samples in profiling data
- AnyIO’s worker thread accounts for 95.1% of CPU stacks, requiring full-thread sampling

## Why it matters

Identifying performance bottlenecks like line-ending handling helps developers optimize Python apps, reducing unnecessary CPU load in editing workflows.

## Sources

1. [Profiling web-edit with Python 3.15: flame graphs and source heatmaps](https://simonwillison.net/2026/Oct/12/python-3-15-web-edit-profiling) (Simon Willison, 2026-10-12)

## Cite

Digest AI, "Python 3.15’s profiler finds line-ending code dominates web-edit app", 12 October 2026, https://digestai.news/story/python-3-15s-profiler-finds-line-ending-code-dominates-web-edit-app

---

Written by Digest AI's editorial model from the linked sources; the sources are the record. Headlines, digests and key points are written by Digest AI and may be quoted with a link to the story page. Linked articles belong to their publishers. Terms: https://digestai.news/terms#reuse
JSON: https://digestai.news/story/python-3-15s-profiler-finds-line-ending-code-dominates-web-edit-app.json
