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-progressiondef 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 optimaldef production_function(data):return process(data)
3. Use Environment Variables for Deployment
# Developmentexport EPOCHLY_MODE=balanced# Productionexport EPOCHLY_LEVEL=2
4. Profile First
Understand your bottlenecks:
@epochly.performance_monitordef baseline_function(data):return process(data)# Check metricsprint(epochly.get_metrics())
5. Test Optimizations
Verify correctness before deploying:
# Compare resultsoriginal_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