by sgammon on 6/3/25, 7:59 PM with 33 comments
We've written a pretty cool Gradle plugin I wanted to share.
It turns out if you native-image the Java and Kotlin compilers, you can experience a serious gain, especially for "smaller" projects (under 10,000 classes).
By compiling the compiler with native image, JIT warmup normally experienced by Gradle/Maven et al is skipped. Startup time is extremely fast, since native image seals the heap into the binary itself. The native version of javac produces identical outputs from inputs. It's the same exact code, just AOT-compiled, translated to machine code, and pre-optimized by GraalVM.
Of course, native image isn't optimal in all cases. Warm JIT still outperforms NI, but I think most projects never hit fully warmed JIT through Gradle or Maven, because the VM running the compiler so rarely survives for long enough.
Elide (the tool used by this plugin) also supports fetching Maven dependencies. When active, it prepares a local m2 root where Gradle can find your dependencies already on-disk when it needs them. Preliminary benchmarking shows a 100x+ gain since lockfiles prevent needless re-resolution and native-imaging the resolver results in a similar gain to the compiler.
We (the authors) are very much open to feedback in improving this Gradle plugin or the underlying toolchain. Please, let us know what you think!
by pjmlp on 6/4/25, 9:49 AM
I never touch Gradle unless there is no way around it, like Android.
However, this looks like an interesting idea.
by jart on 6/3/25, 10:08 PM
For example, what does resolution mean? Does that mean fetching the pom.xml files from sonatype to figure out the dependency graph? Don't those HTTP requests normally go fast? Is Elide sort of like setting up an HTTP caching proxy between corp and sonatype?
by alisonatwork on 6/3/25, 11:43 PM
Not to detract from the cool work done here, just curious if this other approach has been tried too.
by sgammon on 6/3/25, 11:05 PM
by kristianp on 6/3/25, 11:59 PM
by linksbro on 6/4/25, 1:31 AM
by re-thc on 6/4/25, 3:02 AM
by lemming on 6/4/25, 10:00 AM
by normie3000 on 6/4/25, 6:05 AM
Also what's the licence for elide?
by Zardoz84 on 6/4/25, 7:09 AM
by rjwalters on 6/4/25, 6:10 AM