``` inline class Test(private val value: Byte) { ...
# compiler
m
Copy code
inline class Test(private val value: Byte) {
	fun toLong() = value.toLong()
}
Would I get any noteworthy performance benefit from making
toLong()
inline
? In general I'm not sure how functions of inline classes are actually invoked. As static functions with the inline value as parameter?
d
1) This probably isn't the right channel to ask that question (this is mostly for people writing compiler plugins or contributing to the compiler). 2) The only way to evaluate performance questions like this is to benchmark the two different versions. I doubt there's a difference in this particular case. 3) Generally the only time you want to make methods inline is if the compiler requires it, or if you're passing lambdas.
m
Thank you 🙏
🙂 1
m
As static functions with the inline value as parameter?
Yes, that's true if inline instance is not boxed.
Would I get any noteworthy performance benefit from making
toLong()
inline
?
I think JIT will inline such a small method otherwise, and the result machine code will be the same.
🙏 1