When to use inline function
-
For function with higher order function (lambda), make the function inline will save some memory by avoiding Function object creation.
-
If the reference for higher order function is used, inline can’t be applied to it.
-
Inline a function will grow the size of app, and then better do it when the function is simple and contains only few lines of codes.
-
noinline to annotate which higher order function should not converted to inline
References
Inline functions - Kotlin Vocabulary