---
title: "Python: tprof 1.3.0: now with less overhead"
url: https://daily.dev/posts/python-tprof-1-3-0-now-with-less-overhead-z5sx5alai
source_url: https://adamj.eu/tech/2026/08/08/python-tprof-performance
type: article
source: "Adam Johnson"
published: 2026-08-08T21:16:36.453Z
updated: 2026-08-08T21:17:05.800Z
tags: ["python", "performance"]
reading_time: 4
upvotes: 0
comments: 0
language: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Python: tprof 1.3.0: now with less overhead

**[Adam Johnson](https://daily.dev/sources/adamj)** · 4 min read · 0 upvotes · 0 comments

## Summary

tprof 1.3.0 is released with major performance improvements for this Python 3.12+ targeting profiler. Key changes include replacing Python data structures with per-thread C structures storing raw int64_t nanosecond values, disabling sys.monitoring callbacks entirely for non-target code, and using PyTime_PerfCounterRaw() on Python 3.13+. Benchmarks show target function overhead reduced ~3×, non-target functions now run at full speed (zero overhead), memory use is 4× lower, and report generation is ~100× faster. New features include --json/--baseline flags for cross-branch performance comparisons, median replacing mean as the headline statistic (computed via quickselect in C), and programmatic access to results via FunctionStats objects yielded from the tprof() context manager/decorator.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://adamj.eu/tech/2026/08/08/python-tprof-performance>

## Questions this post answers

### How much overhead does tprof add to profiled functions in Python 3.13?

In tprof 1.3.0 on Python 3.13, a target function call takes about 170ns (+141ns overhead vs. unprofiled), down from 469ns (+439ns) in previous versions — roughly a 3× reduction. Non-target functions now run at full speed with zero added overhead (28ns, +0), compared to 440ns (+410ns) before. Memory per 1M calls dropped from 34.8 MiB to 8.0 MiB, and report generation went from ~430ms to ~3ms.

_Python developers benchmarking profiler overhead track tprof releases and similar tooling on daily.dev._

### How do I compare tprof results across two Git branches in Python?

Use tprof's --json flag to save results from one branch, then pass that file to --baseline on the other branch. Run `tprof -t lib:maths --json before.json ./example.py` on the baseline branch, then after checking out your change run `tprof -t lib:maths --baseline before.json ./example.py`. The report adds a delta column showing each function's median change as a percentage.

_Teams optimizing Python code across branches find workflow tips like this on daily.dev._

### How do I access tprof profiling results programmatically in Python instead of just reading the printed report?

The tprof() context manager and decorator now yield a list of FunctionStats objects once the profiled block ends. Each FunctionStats exposes name, calls, total_ns, min_ns, max_ns, median_ns, and stdev_ns — the same fields as --json output. Use `with tprof(maths) as results:` and then unpack or iterate results after the block completes.

_Developers building automated performance regression checks on Python code follow tooling like tprof on daily.dev._

## Similar posts on daily.dev

- [Python: introducing tprof, a targeting profiler](https://daily.dev/posts/python-introducing-tprof-a-targeting-profiler-ckmqw3ibi) · Adam Johnson · 38 upvotes · 1 comments
- [profiling.sampling — Statistical profiler ¶](https://daily.dev/posts/profiling-sampling-statistical-profiler--bd9rldcma) · Hacker News · 1 upvotes · 0 comments
- [Python 3.15 Has a Production Profiler. Python 3.15 Is Not Production-Ready.](https://daily.dev/posts/python-3-15-has-a-production-profiler-python-3-15-is-not-production-ready--wgbuvk9t9) · Medium · 1 upvotes · 0 comments
- [What’s new in Python 3.15 ¶](https://daily.dev/posts/what-s-new-in-python-3-15--0wvfayvfu) · Hacker News · 1 upvotes · 0 comments
- [Python: introducing profiling-explorer](https://daily.dev/posts/python-introducing-profiling-explorer-eb3yvhchy) · Adam Johnson · 1 upvotes · 0 comments

---

Tags: [#python](https://daily.dev/tags/python), [#performance](https://daily.dev/tags/performance)

[View this post on daily.dev](https://daily.dev/posts/python-tprof-1-3-0-now-with-less-overhead-z5sx5alai)
