---
title: "Performance Optimization" component_type: hook version: "1.0.0" audience: contributor status: stable summary: " Performance Optimization Detection Hook for CODITECT" keywords: ['analysis', 'database', 'git', 'optimization', 'performance'] tokens: ~1500 created: 2025-12-22 updated: 2025-12-22
Performance Optimization Detection Hook for CODITECT
Identifies performance anti-patterns, inefficient code, and optimization opportunities. Suggests optimizations without blocking operations.
Event: PostToolUse Matcher: tool_name = "Write|Edit|Bash" Trigger: After code changes, test execution, or git commits
File: performance_optimization.py
Classes
PerformanceAnalyzer
Analyzes code for performance issues and optimization opportunities
Functions
main()
Main hook entry point
analyze_python_performance(content, file_path)
Detect Python performance anti-patterns
analyze_bash_performance(content)
Detect Bash performance anti-patterns
analyze_file_size(content, file_path)
Detect when files are getting too large
analyze_git_operations(command)
Detect performance issues in git operations
generate_report()
Generate optimization report
analyze(file_path, content, event)
Analyze file/operation for performance issues
Usage
python performance_optimization.py