Python Code Profiling Libraries logopeterindia.net
Knowledge Hub

Python Code Profiling Libraries: py-spy, Scalene, memray & More

Profilers for finding Python performance and memory bottlenecks: built-in, sampling, line-level, memory and tracing tools.

20 topics•5 categories•Updated October 2026

Built-in Tools

4 entries

Included with Python.

CPU & Sampling Profilers

6 entries

Find where time is spent.

Memory Profilers

2 entries

Find where memory goes.

Tracing & Visualization

3 entries

Timelines, flame graphs and viewers.

Related Pages

5 entries

Neighbouring pages on this site.

Frequently Asked Questions

How do I profile Python code?

Start with cProfile or a sampling profiler such as py-spy or Pyinstrument to find hot functions, then use line_profiler for detail and memray or tracemalloc for memory.

What is the difference between deterministic and sampling profilers?

Deterministic profilers such as cProfile record every call and add overhead, while sampling profilers such as py-spy check the stack periodically and are cheaper for production use.

Is memory_profiler still maintained?

Its last GitHub update was in April 2024, so consider memray or tracemalloc for new work.

How current is this page?

Links were checked in October 2026. Sites that block automated checks are kept and may need a manual click. Last-commit dates are from GitHub in October 2026 and show activity only; check each project's release notes before adopting it.