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

Pere Casafont

07/01/2019, 4:43 PM
Does anybody know why there's a warning for inlining functions that don't take lambda parameters? Such as
Copy code
inline operator fun Int?.plus(other: Int?) = if (this != null && other != null) {
    this + other
} else {
    null
}
Let's say I want to use this in places that are called millions of times per second. Wouldn't the
inline
modifier improve performance there as well?
k

kralli

07/01/2019, 4:51 PM
The JVM will most likely inline your call anyway, if it thinks it can profit from doing so. So the expected profit is most likely very small.
p

Pere Casafont

07/02/2019, 9:38 AM
Good to know, thank you
2 Views