Skip to main content
Version: Next

inline

The decorator @inline on a function definition informs the compiler that the function must be inlined wherever it is called. This enables some optimisations, possibly at the expense of a larger compiled code. Benchmarks and profiling help decide whether a function should be inlined or not.

For more information about inlining functions, see Inlining.

Inlining also makes it cheap to create aliases of functions. For example:

@inline
const size = <elt>(list: List.t<elt>) : nat => List.length(list);