Function Design for Compilation
May 30, 2026 | 5 min read
Keep Functions Short
Functions under 100 lines compile fastest and optimise best.
Minimise Side Effects
Pure functions with return values compile better than functions that mutate global state.
Avoid *args and **kwargs
Explicit argument lists compile to more efficient calling conventions.
Return Early
def find(data, target):
for i, x in enumerate(data):
if x == target:
return i
return -1