03/16/2023, 11:55 PM
running into an interesting situation where some basic math to colorize a f16 depth image to rgb is running more than 2x slower in Kotlin than in Java... is there an equivalent of the Kotlin Bytecode viewer but in Java I can use to compare?
Here's a gist of the function:
java takes 20-25ms, kotlin takes 60+
my guess is all the boxing
all the operators are calling
, etc
Updated the gist with dex bytecode from java and kotlin files, you can see that the kotlin dex is full of
from basic math functions due to operator overloading... is this expected? should the compiler be able to inline or optimize that out?
hmmm looking at a release build this seems to be fixed in the kotlin bytecode, but let me confirm...
yep definitely fixed in release. I guess that's expected then? just somewhat surprising behavior. there's an easy way to enable that optimization in a debug build that'd be nice
Ah dang, this is totally a jetpack compose thing