Scalene

Scalene

github.com

1

About this website

Scalene is a high-performance, low-overhead CPU and memory profiler for Python, developed by the PLASMA Lab at the University of Massachusetts Amherst (led by Professor Emery Berger). Unlike traditional Python profilers like cProfile or line_profiler, which either provide function-level granularity with high overhead or line-level granularity with even higher overhead, Scalene achieves line-level precision with minimal performance impact through a unique sampling-based architecture. Scalene uses a combination of signal-based sampling (using SIGPROF for CPU profiling and custom signals for memory allocation tracking) and a separate profiler thread that runs concurrently with the profiled Python code, minimizing the observer effect that plagues other profilers. Key features include: CPU profiling split into Python time (time spent executing Python code) and native time (time spent in C extensions or system calls), enabling developers to identify whether bottlenecks are in their Python code or in underlying libraries; precise memory allocation tracking at the line level (showing exactly which lines allocate the most memory, with per-line allocation counts and sizes); copy volume tracking (detecting how much data is being copied, which is often a hidden performance killer in Python); GPU profiling support (tracking GPU memory and utilization); support for profiling multi-threaded and multi-process Python applications; an interactive web-based UI (scalene --web) that displays profiling results as an interactive HTML page with sortable columns, flame graphs, and source code highlighting; JSON output for programmatic analysis; and support for both Python 3 and native C extensions. As of 2026, Scalene has over 12,000 stars.

Tags & Categories

Categories

Tags

Statistics

1
Views
0
Clicks
0
Like
0
Dislike

Comments

Log In to post a comment

No comments yet. Be the first!