Understand Scalene's profiling capabilities
masterScalene is a high-performance Python profiler that uses sampling to minimize overhead (typically 10-20%). It provides line-level and function-level granularity for several metrics:
- CPU Profiling: Separates time spent in Python from native code (C/C++ libraries) and identifies system time (I/O bottlenecks).
- GPU Profiling: Reports GPU time (currently limited to NVIDIA-based systems).
- Memory Profiling: Tracks memory usage per line, identifies likely memory leaks, separates Python vs. native memory consumption, and profiles copying volume (MB/s) to detect inefficient data conversions.
- Async Profiling: Attributes
awaittime to specific lines, including mean and peak concurrency of coroutines. - Stack Views: When
--stacksis enabled (default), it provides stitched Python + native call stacks, memory-weighted flame charts, and a wall-clock timeline.