Found a nice trick. The JVM has a problem where th...
# compose-desktop
a
Found a nice trick. The JVM has a problem where the first time you use some code, it takes a while because of all the classloading, and the first run is always interpreted, until the JIT catches up. So during app startup (say while showing a splashscreen), or at some other convenient time, I render (2-3 times) my main screens via
ImageComposeScene
. That way when the user gets to opening them, they’re already loaded and compiled, and therefore fast.
think smart 5
But you need to do it carefully - you can’t have your main UI and the content of
ImageComposeScene
be composed concurrently.
You can vote for this to have that limitation removed.
m
In the long run being able to use GraalVM/native-image is probably the better solution. Just my 2 €ent 😉.
j
Longer term this is all about what Project Leydon in the JDK is about, and using AppCDS today would be a good start to minimize the classloading penalty
👍🏻 1
m
Or maybe CRaC by Azul.
s
I didn't know about Project Leydon! This has become increasingly important in serverless environments and for compose Desktop. Graal native images are a fun idea, but are also a huge cost in complexity / messing around with them. Not to mention, their build times.
h
Does anyone know AppCDS is only enabled by default on J9? We do have a great experience on zOS with this feature.
m
Just to make searching easier. It’s “Leyden”, not “Leydon”. See: https://openjdk.org/projects/leyden/