Documentation

Decorators API Reference

Function decorators for applying Epochly optimizations.


@optimize

Main optimization decorator. Applies progressive enhancement based on configured level.

Signature

@epochly.optimize
def function(args):
...
@epochly.optimize(level=3)
def function(args):
...
@epochly.optimize(level=2, threshold=100)
def function(args):
...

Parameters

ParameterTypeDefaultDescription
levelintNoneTarget enhancement level (0-4)
thresholdint1000Calls before optimization kicks in
monitorboolTrueEnable performance monitoring

Example

import epochly
@epochly.optimize
def process_data(data):
return [x ** 2 for x in data]
@epochly.optimize(level=3)
def heavy_computation(matrix):
return matrix_multiply(matrix)

@performance_monitor

Add performance monitoring without optimization.

Signature

@epochly.performance_monitor
def function(args):
...
@epochly.performance_monitor(detailed=True)
def function(args):
...

Parameters

ParameterTypeDefaultDescription
detailedboolFalseCollect detailed metrics
log_callsboolFalseLog each function call

@jit_compile

Force JIT compilation for numerical functions.

Signature

@epochly.jit_compile
def function(args):
...
@epochly.jit_compile(backend='numba', cache=True)
def function(args):
...

Parameters

ParameterTypeDefaultDescription
backendstr'auto'JIT backend ('auto', 'numba', 'native')
cacheboolTrueCache compiled code
parallelboolFalseEnable parallel execution
nopythonboolTrueNumba nopython mode

@full_optimize

Apply maximum optimization (Level 3 or 4).

Parameters

ParameterTypeDefaultDescription
gpuboolFalseEnable GPU if available
workersintNoneNumber of workers

@threading_optimize

Apply Level 1 threading optimization for I/O-bound functions.

Parameters

ParameterTypeDefaultDescription
max_workersintNoneMaximum thread count