Summary
Expand the performance profiler to detect additional common Python anti-patterns beyond the current 6 categories.
Proposed New Patterns
- Exception handling inside loops - Try/except catching expected conditions (slow)
- Repeated dict/set lookups in loops - O(1) operations that could be cached outside the loop
- List comprehension vs generator - Places where generators would save memory
- Unbounded recursion - Functions with no depth limit that could stack overflow
- Missing
__slots__ - Classes with many instances not using __slots__ for memory
- Type conversions in loops -
int(), str() conversions done repeatedly
- Global variable mutation - Functions that modify global state
Implementation
- Define patterns in
src/workshop_mcp/performance_profiler/patterns.py
- Add detection logic in
performance_checker.py
- Write tests in
tests/test_performance_checker.py
Acceptance Criteria
Summary
Expand the performance profiler to detect additional common Python anti-patterns beyond the current 6 categories.
Proposed New Patterns
__slots__- Classes with many instances not using__slots__for memoryint(),str()conversions done repeatedlyImplementation
src/workshop_mcp/performance_profiler/patterns.pyperformance_checker.pytests/test_performance_checker.pyAcceptance Criteria