Documentation

Level 2: JIT Compilation

Level 2 provides JIT compilation for CPU-bound loops and numerical code.

Overview

AspectValue
First Call Overhead~100-500ms (compilation)
Subsequent Calls~5μs
Memory~50MB
Best ForCPU-bound loops

JIT Backends

Python VersionPrimary BackendFallback
3.9-3.10NumbaPyston-Lite
3.11-3.12NumbaNone
3.13+Native JITNumba

Enabling Level 2

import epochly
@epochly.optimize(level=2)
def compute(data):
result = 0
for x in data:
result += x ** 2
return result

Supported Code Patterns

  • Numerical Loops: Simple arithmetic in loops
  • Array Operations: Element-wise array processing
  • Nested Loops: Multi-dimensional iteration

Speedup Factors

Operation TypeTypical Speedup
GPU elementwise (10M+)66–70x
GPU convolution (batched)14–19x
Parallel CPU (heavy tasks)8–12x

Best Practices

  1. Use for Large Data: GPU shines on arrays with 10M+ elements
  2. Use for Heavy Tasks: Parallel execution works best with tasks >100ms each
  3. Don't Force It: Epochly yields to normal behavior when it can't help