refactoring_todo.md
Refactor scalene/scalene_profiler.py into multiple files with clear separation of concerns.
All verification checks pass:
pytest tests/ - 147 tests passedmypy scalene - No issues foundruff check scalene - All checks passed| File | Lines |
|---|---|
scalene_profiler.py | 1,584 (was 1,885) |
scalene_cpu_profiler.py | 228 (new) |
scalene_tracing.py | 225 (new) |
scalene_lifecycle.py | 198 (new) |
Net reduction: ~300 lines from main profiler, with reusable logic extracted
scalene_cpu_profiler.py ✅ScaleneCPUProfilerprocess_cpu_sample - Main CPU sample handler_update_main_thread_stats - Main thread statistics_update_thread_stats - Other thread statisticsscalene_tracing.py ✅ScaleneTracinglru_cacheshould_trace - Main entry point (cached)_passes_exclusion_rules - Library exclusions_should_trace_by_location - Path-based filtering_is_system_library - System library detectionscalene_lifecycle.py ✅ScaleneLifecyclescalene_profiler.py (Scalene class)
├── ScaleneCPUProfiler (CPU sample processing)
├── ScaleneTracing (file/function filtering)
├── ScaleneMemoryProfiler (already existed)
└── ScaleneSignalManager (already existed)
Filename consistentlylru_cache usage