Hey all. I was hoping I could get some clarificati...
# getting-started
o
Hey all. I was hoping I could get some clarification about the
inline
modifier for functions. The Kotlin lang webpage for inline function states “Inlining may cause the generated code to grow. However, if you do it in a reasonable way (avoiding inlining large functions), it will pay off in performance, especially at “megamorphic” call-sites inside loops.” When it states that we should avoid inlining large functions, does this refer solely to the function receiving the
inline
modifier or does it apply to the contents of the lambda (which is being passed to the inlined function) as well?
j
In my understanding, it doesn't include the lambda body. The problem of code growth is due to the repetition of the inlined code, but each lambda body is theoretically unique, so in that sense it doesn't contribute to the duplicated bytecode
o
🙏