Releases: plasma-umass/scalene
New visualizations, accuracy improvements, and bug fixes
What's Changed
Headlines
- Adds call graphs ("flame graphs") spanning from Python to native code, organized by % of time
- Timeline view of call graphs ("flame chart"), including GIL, I/O, and GC activity
- Flame graph for memory allocations, attributing memory to call stacks
- Improved memory attribution (now tracked per-thread)
- Adds proper support for free-threaded Python
New feature work
- True free-threaded Python support: full memory + CPU profiling by @emeryberger in #1026
- Bucket native-thread allocations under (#857) by @emeryberger in #1031
- Native (C/C++) stack collection via signal-handler unwinding by @emeryberger in #1034
- Stitched Python+native stacks (combined_stacks) by @emeryberger in #1035
- GUI: combined_stacks viewer (top-N stitched Python+native stacks) by @emeryberger in #1037
- Timeline view for stitched Python+native stacks by @emeryberger in #1040
- Memory flame chart + sync per-sample stack capture by @emeryberger in #1042
- Shrink stack+timeline RAM, harden profiler self-exclusion by @emeryberger in #1043
- Shrink combined_stacks JSON and enforce schema validation by @emeryberger in #1044
- Timeline + memory-stacks polish: axes, gridlines, source-line tooltips by @emeryberger in #1045
- Minify the GUI bundle (-56% on disk) by @emeryberger in #1046
- GUI improvements: resizable charts, C++ demangling, stack filtering by @emeryberger in #1047
- Add per-thread native stack sampling for worker threads by @emeryberger in #1048
- Make --stacks the default; add --no-stacks opt-out by @emeryberger in #1050
- Drop C-side smear from per-line memory attribution and the flame view by @emeryberger in #1051
Bug fixes
- Fix root cause of resource tracker death in child processes (#1017) by @emeryberger in #1024
- Fix SIGSEGV on free-threaded Python with memory profiling by @emeryberger in #1025
- Fix memory profiling regressions by @emeryberger in #1027
- Fix CLI line number truncation for lines > 999 by @emeryberger in #1028
- Fix issue #1022: pytest-xdist + --profile-all on Linux dropped user samples by @emeryberger in #1055
- Clamp core_utilization to [0, 1] (fixes #1032) by @emeryberger in #1033
Full Changelog: v2.2.1...v2.3.0
Scalene v2.2.1
Scalene v2.2.1
Bug Fixes
-
sys.monitoring tool ID conflict with PyTorch (#1015, #1019): Fixed SIGSEGV crash when using Scalene with PyTorch Lightning on Python 3.12+. When PROFILER_ID is already claimed by another tool, Scalene now falls back to alternative tool IDs (3 or 4), or gracefully uses the legacy
PyEval_SetTracetracer. -
TensorFlow 2.21+ compatibility (#1018): Fixed compatibility with TensorFlow 2.21+ where
trace.enabledchanged from a callable to a bool. Scalene now applies a compatibility fix at profiler start time. -
Multiprocessing resource tracker (#1017): Fixed
BrokenPipeErroron NixOS with Python 3.13/3.14 when the resource tracker subprocess dies during semaphore creation. Scalene now falls back fromspawn/forkservertoforkcontext. -
Subprocess profiling (#1013): Fixed profiling failing when Python interpreter flags (like
-Bor-u) precede-cor-min subprocess invocations. -
Windows timer thread shutdown (#1012): Fixed fatal
gilstate_tss_seterror on Windows when the timer thread shuts down. -
Windows
--on/--offsupport (#1010): Added support for--onand--offflags on Windows using Named Events. -
__future__flags in exec/eval (#1008): Fixed__future__compiler flags not being propagated inexec/eval/compilereplacements. -
Windows multiprocessing (#1005, #998): Fixed spawn-mode multiprocessing Pool support on Windows, including pickle corruption and memoryview cleanup issues.
New Features
-
Async-aware profiling (#1006): Added async-aware profiling support using
sys.monitoringon Python 3.12+. -
C23 allocator support (#1011): Added support for C23
free_sizedandfree_aligned_sizedfunctions in SampleHeap.
Other Changes
- Improved shell script portability for NixOS/Guix using
#!/usr/bin/env bash - Code formatting updates via Black
Full Changelog: v2.1.4...v2.2.1
Maintenance release with bugfixes and performance improvements
What's Changed
- Refined attribution approach for C vs. Python by @emeryberger in #1001
- Fix Python 3.14 compatibility for eval()/exec() keyword arguments by @emeryberger in #1002
- Fix memory explosion and extreme slowness during profiling by @emeryberger in #1004
Full Changelog: v2.1.3...v2.1.4
Improved attribution, off-line mode, and fix for Jupyter
What's Changed
- Fix loop backward-jump sampling bias with even redistribution by @emeryberger in #995
- Fix Google Analytics loading delay in offline/standalone mode by @Copilot in #996
- Fixed Jupyter magics. by @emeryberger in #997
Full Changelog: v2.1.2...v2.1.3
v2.1.2
What's Changed
Bug Fixes
- Fix Windows CPU profiling extreme slowness and memory explosion (#992): The v2.1 Windows timer loop hardcoded a 1ms sampling interval regardless of the configured rate (default 10ms), generating ~10x more samples than intended and reducing
sys.setswitchintervalto 1ms causing excessive GIL contention. Now uses the actual configured sampling rate.
Improvements
- Bound memory footprint samples with reservoir sampling (#993): Replace unbounded list accumulation of memory footprint samples with
sorted_reservoir(Vitter reservoir sampling), capping memory at O(k) instead of O(n) where n is the number of malloc/free events. Eliminates unbounded memory growth during long profiling runs.
Full Changelog: v2.1.1...v2.1.2
Improves JAX and TensorFlow support; fixes Windows issue
What's Changed
- Add library profiler infrastructure for JAX and TensorFlow by @emeryberger in #990
- Removes stray debug statements on Windows.
Full Changelog: v2.1.0...v2.1.1
Numerous updates and bug fixes
UI, Frontend & Visualization
- Convert scalene-gui JavaScript to TypeScript by @emeryberger in #970
- Add Google Gemini provider, environment variable support, and UI modernization by @emeryberger in #973
- Vendor assets locally for offline HTML viewer support by @emeryberger in #983
- Add per-file display mode dropdown for profile filtering (fixes #813) by @emeryberger in #989
LLM / API Provider Support
- Add support for OpenAI-compatible API servers and Anthropic (fixes #918) by @emeryberger in #971
- Add Google Gemini provider, environment variable support, and UI modernization by @emeryberger in #973
CPU & Core Profiling Engine
- Optimize CPU profiling instrumentation by @emeryberger in #988
- Fix crash when frame.f_lineno is None in Python 3.11+ by @emeryberger in #976
Multiprocessing, Exec, and Runtime Compatibility
- Fix multiprocessing spawn mode support (#873) by @emeryberger in #984
- Fix multiprocessing spawn mode sys.argv handling (#846) by @emeryberger in #986
- Add profiling support for exec'd code (fixes #824) by @emeryberger in #987
- Fix signal conflict crash with PyTorch Lightning and similar libraries by @emeryberger in #977
PyTorch & JIT Integration
- Add PyTorch JIT profiling support (fixes #908) by @emeryberger in #972
GPU & Apple Silicon
- Add per-process MPS GPU profiling for Apple Silicon by @emeryberger in #974
Windows Support & Reliability
- Improve Windows memory profiling error messages and documentation by @emeryberger in #978
- Fix Windows CPU profiling not collecting samples by @emeryberger in #980
Notebook & Editor Integration
- Fix Jupyter notebook display in VSCode (fixes #951) by @emeryberger in #969
v2.0.1
Trigger re-build to produce libscalene.dll.
Major new release: Windows memory profiling support, improved CLI, and performance optimizations
What's Changed
- Fix for pickling support (multiprocessing issue on Windows) by @emeryberger in #954
- CI update to 3.14 by @emeryberger in #955
- Restore 3.8 support by @emeryberger in #958
- Fixed formatting of CLI help. by @emeryberger in #962
- Overhauled CLI. by @emeryberger in #963
- Windows memory profiling by @emeryberger in #965
- Initial sys.monitoring approach for memory profiling. by @emeryberger in #966
- Refactor scalene_profiler.py into modular components by @emeryberger in #967
Full Changelog: v1.5.55...v2.0.0
Maintenance release for Windows
What's Changed
- Fix signal timer resetting by @sternj in #946
- Cleanup; fixes #947. by @emeryberger in #948
- Removed unused methods and variables. by @emeryberger in #949
- Removed cruft, privatized more methods. by @emeryberger in #950
Full Changelog: v1.5.54...v1.5.55