Level 3: Multicore Parallelism
Level 3 provides true parallelism by bypassing Python's GIL.
Overview
| Aspect | Value |
|---|---|
| Startup Overhead | ~500ms (pool initialization) |
| Per-Call Overhead | ~100μs |
| Memory | ~100MB |
| Best For | CPU-bound parallel work |
Parallelism Mechanisms
Python 3.12+: Sub-interpreters
- Each sub-interpreter has its own GIL
- Lower memory overhead than processes
- Faster startup than ProcessPool
Python 3.9-3.11: ProcessPool
- Separate processes bypass GIL
- Higher memory overhead
- Data serialization required
Enabling Level 3
import epochly@epochly.optimize(level=3)def parallel_compute(data):return [x ** 2 for x in data]
Speedup Expectations
| Core Count | Typical Speedup |
|---|---|
| 4 cores | 2–3x |
| 8 cores | 4–6x |
| 16 cores | 8–12x |
| 32 cores | 14–20x |
When Level 3 Helps
- Data-parallel loops
- Independent calculations
- Map operations
- Large dataset processing (> 100K items)
When Level 3 Does Not Help
- Small data (< 100K items)
- Sequential dependencies
- Frequent small operations