finds.dev← search

// the find

joerick/pyinstrument

★ 7,957 · Python · BSD-3-Clause · updated Jul 2026

🚴 Call stack profiler for Python. Shows you why your code is slow!

Pyinstrument is a statistical call-stack profiler for Python that samples at 1ms intervals rather than tracing every function call, so the overhead is low enough to leave running in development without it distorting what you're measuring. It's aimed at application developers who want to find the slow part of a request or script without wading through thousands of stdlib frames.

The HTML output is genuinely good — interactive timeline mode with zoom, collapsible call tree, keyboard navigation, and a Svelte frontend that keeps file sizes small. Async support is real: it tracks time spent awaiting and attributes it correctly, not just dumping everything into the event loop. The library-frame collapsing is smarter than most profilers — it detects your virtualenv/conda paths at profile time rather than matching on '/lib/' as a substring, so you get fewer false positives. First-class integrations for Django middleware, FastAPI, pytest, Jupyter, and IPython magic mean you can drop it into an existing project with two lines.

Statistical sampling at 1ms means anything faster than a few milliseconds is invisible — if you're optimizing tight inner loops or C extension calls, you need cProfile or a tracer instead. Docker environments can produce skewed results because gettimeofday is slow in that context, and the workaround (timing thread or coarse timer) requires knowing to look for the warning. The HTML renderer bundles the full profile JSON into the HTML file, which the changelog acknowledges can crash the browser for large profiles — they added a sample count cap as a band-aid rather than fixing the underlying data architecture. No continuous or production profiling story: this is a developer tool, not something you'd run in prod to catch intermittent slowdowns.

View on GitHub → Homepage ↗

// want more like this?

We dig through GitHub every week and send a few repos picked for what you actually care about — each with an honest take like this one.

Get finds in your inbox → Search again →