# Optimization Target Scan

## Candidate Modules with Real Python Work

### 1. Cache System (odoo/tools/cache.py)
- **Size**: 384 lines
- **Type**: Pure Python cache implementation
- **Operations**: Key computation, LRU eviction, invalidation
- **Tests**: odoo/addons/base/tests/test_cache.py, test_ormcache.py
- **Priority**: HIGH - Core performance infrastructure

### 2. Query Builder (odoo/tools/query.py)
- **Size**: 276 lines
- **Type**: SQL query construction
- **Operations**: Query building, optimization, parameter binding
- **Tests**: odoo/addons/base/tests/test_query.py
- **Priority**: HIGH - Database access patterns

### 3. Translation System (odoo/tools/translate.py)
- **Size**: 1991 lines
- **Type**: Text processing and i18n
- **Operations**: String parsing, format conversion, catalog management
- **Tests**: odoo/addons/base/tests/test_translate.py
- **Priority**: MEDIUM - Large module, may have algorithmic work

### 4. Misc Utilities (odoo/tools/misc.py)
- **Size**: 1967 lines
- **Type**: General utility functions
- **Operations**: Various data processing, formatting, helpers
- **Tests**: odoo/addons/base/tests/test_misc.py, odoo/addons/test_http/tests/test_misc.py
- **Priority**: MEDIUM - Broad surface area

## Scan Approach

1. Create minimal benchmarks for each module's hot paths
2. Profile with cProfile + tracemalloc to identify Python self-time
3. Avoid modules dominated by:
   - C extension calls (lxml, psycopg2)
   - I/O operations
   - External library overhead

4. Focus on algorithmic patterns:
   - Loop structures
   - Data structure choices (list vs deque, dict vs set)
   - Redundant computations
   - String operations
   - Cache efficiency

## Expected Optimization Patterns

Based on module types:
- **Cache**: Key computation efficiency, eviction algorithms, data structures
- **Query**: String building patterns, parameter handling, query optimization logic
- **Translate**: String parsing, regex usage, data structure for catalogs
- **Misc**: Various - need profiling to identify specific patterns
