Would running android’s R8 over a compose desktop ...
# compose-desktop
u
Would running android’s R8 over a compose desktop jar help anything perf wise?
j
For sure
u
hmm byt that token, would R8 help ktor/spring boot as well? Say with startup?
j
Yep. Fewer classes to load means less I/O. Fewer methods means less bytecode to verify. Overall that's lower memory pressure and improved performance.
Using ProGuard is a good start, though
u
Can I run R8 over jar? Or why do you mention proguard?
j
Yes, R8 has both a Dalvik bytecode backend and a Java bytecode backend
u
Uhm are you maybe aware of a gradle plugin or do I just try to grab the R8 binary from internet and use it directly?
j
I use it directly, but you kinda need to know what you're doing
u
compose desktop app, nothing special, usual gradle build, I'm not necessarily unsatisfied with startup speed but if there's something not too difficult I could apply as part of release binary then I want it
j
Surely someone has come up with a Gradle plugin for this
The feature request for first-party support is https://youtrack.jetbrains.com/issue/CMP-5121
No Compose UI for JVM examples, though
u
Btw what about the latest java? Isn't there an effort to minimaze memory usage, which should improve java ui apps by default significantly?
j
Java 25 uses compact object headers by default now. Previously it was an experimental, opt-in feature.
u
I have some manual usage here..
oh neat thank you!
j
That will reduce memory pressure which also means more code can fit into the code cache so it should also improve performance.
In general I would expect every new Java release to be faster than the last, so using the latest is always a good idea.
u
Yea, I'm currently lamenting if I should bundle jre with the compose app or not, due to the size it adds; but I guess this should be worth it Btw kotlin will work with it just fine? Doesn't kotlinc emit something older that would not take advantage of the compact object headers etc?
j
It's a VM feature. Has nothing to do with the bytecode
But yes, Kotlin hasn't used anything new in bytecode since like Java 11
u
I see are they waiting for valhalla to drop? 😄
c
fwiw. i did some size comparisons with progurad here: https://dev.to/coltonidle/compose-for-desktop-app-size-comparison-3d8h
u
Nice btw that is proguard however right? Isnt R8 supposed to be more aggressive -> more savings?
c
correct. proguard is built in so i just used that.