Documentation

Best Practices

Guidelines for getting the most out of Epochly.

1. Start with Automatic Progression

Let Epochly detect the optimal level:

@epochly.optimize() # Default: auto-progression
def my_function(data):
return process(data)

2. Pin Level for Production

Once optimal level is known, pin it:

@epochly.optimize(level=2) # Known to be optimal
def production_function(data):
return process(data)

3. Use Environment Variables for Deployment

# Development
export EPOCHLY_MODE=balanced
# Production
export EPOCHLY_LEVEL=2

4. Profile First

Understand your bottlenecks:

@epochly.performance_monitor
def baseline_function(data):
return process(data)
# Check metrics
print(epochly.get_metrics())

5. Test Optimizations

Verify correctness before deploying:

# Compare results
original_result = original_function(data)
optimized_result = optimized_function(data)
assert original_result == optimized_result

Common Pitfalls

  • Over-optimizing: Not everything needs Level 3
  • Ignoring overhead: Small workloads may be slower
  • Missing I/O bounds: CPU optimization won't help I/O
  • Forgetting verification: Always test correctness