Are lambdas faster to execute than normal function...
# announcements
r
Are lambdas faster to execute than normal function in Kotlin ?
i
Executing a function depends, may among others, on your environment, context and whether your function is suspending or not.
In short: its not an easy yes no question
d
Very very simple answer is no.
👍 6
e
Idk in Kotlin 1.3, but in past versions lambdas were resolved to anonymous classes by the compiler.
g
but in past versions lambdas were resolved to anonymous classes by the compiler
Same now
It also depends on what is
normal function
and how you call it
m
I assume that a function needs to be
inline
for faster execution. Is that right?
g
If this function doesn't have inline lambda in signature than it will not be faster (just nothing to optimize, it may be optimized by JIT on runtime or some optimizer on compile time)