@no_inline
You can add the @no_inline
decorator on any function to prevent it from being
inlined by the compiler.
@no_inline
fn my_large_function():
...
@no_inline
fn my_large_function():
...
Inlining is an optimization that reduces function call overhead for small,
frequently-called functions. Functions can be explicitly marked for inlining
using
@always_inline
, or may be inlined
automatically by the compiler.
Too many inlined functions can slow compilation and substantially increase the binary size of the compiled program. In particular, large or complex functions may not benefit as much from inlining.
Was this page helpful?
Thank you! We'll create more content like this.
Thank you for helping us improve!