Eager Compilation: Precise Type Control & Zero First-Call Latency
Specifying explicit function signatures, like `@jit('int32(int32, int32)')`, enables eager compilation, providing fine-grained control over data types for optimal machine code generation and eliminating the compilation overhead on the very first function call.
The top 3
- Eager vs. Lazy: Eliminating First-Call JIT Latency: Numba's eager compilation compiles functions when their module loads by requiring predefined type signatures, directly circumventing the first-call latency inherent in its default lazy JIT mode, which compiles upon the initial function execution.
- Type Control Precision: Eager Compilation's Key Advantage: Eager compilation provides precise type control by allowing users to specify exact argument and return types, such as `int32(int32, int32)`. This enables fine-grained specialization for performance-critical scenarios like using single-precision floats.
- When to Choose Eager Compilation for Peak Performance: Eager compilation is ideal for applications where initial runtime latency is unacceptable or strict type adherence is crucial. It ensures functions are compiled immediately and consistently, raising errors for type mismatches rather than incurring recompilation overhead.
Sources
Open the full topic