https://kotlinlang.org logo
#announcements
Title
# announcements
r

Rohan Maity

07/03/2019, 4:43 PM
Are lambdas faster to execute than normal function in Kotlin ?
i

Imran/Malic

07/03/2019, 5:11 PM
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

Dominaezzz

07/03/2019, 5:19 PM
Very very simple answer is no.
👍 6
e

Edward

07/03/2019, 11:15 PM
Idk in Kotlin 1.3, but in past versions lambdas were resolved to anonymous classes by the compiler.
g

gildor

07/04/2019, 1:49 AM
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

Michael Strasser

07/06/2019, 12:06 AM
I assume that a function needs to be
inline
for faster execution. Is that right?
g

gildor

07/06/2019, 1:53 AM
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)
4 Views