What is the difference between `{ stuff }()` and `...
# compiler
a
What is the difference between
{ stuff }()
and
run { stuff }
in terms of performance. Are both of these constructs inlined or only the latter?
e
it's easy to check for yourself
well I guess one thing that is harder to check for yourself (unless you have older versions of the compiler around) is that this has changed over time…
the old JVM backend doesn't inline the former (and the current compiler doesn't let you use
-Xuse-old-backend
anymore, so that's a bit tricky to test)
the JVM IR backend does inline it, although that's not a documented behavior you can rely on AFAIK
a
Thanks!
y
The run version is definitely more idiomatic though. The JS IIFE has no place in Kotlin.