noinline
Noinline is a directive used in several programming languages to prevent the compiler from inlining a function or lambda. Inlining is the optimization that substitutes a function call with the body of the function, reducing call overhead and enabling further optimizations. When noinline is applied, the call remains a distinct call, preserving function boundaries, which can help with debugging, function pointers, and code layout, but may reduce certain performance benefits or increase code size.
In Kotlin, noinline is a modifier applied to a lambda parameter of an inline function to prevent
In Rust, inlining is controlled at the function level with attributes. The attribute #[inline(never)] applied to
In C and C++, compilers such as GCC and Clang provide the noinline attribute to prevent inlining.
Noinline behavior is not portable across languages; syntax and semantics vary by compiler and language. It