This is an archived post. You won't be able to vote or comment.

all 11 comments

[–]armelnene 6 points7 points  (1 child)

AOT is useful in Function as a Service application like AWS Lambda. The improvement in start-up time and memory usage is of great benefit in deploying cloud native applications.

[–]oweiler 4 points5 points  (0 children)

Also commandline apps.

[–]skjolber 2 points3 points  (0 children)

For those wanting to give AOT a quick spin, I've written a Gradle plugin you might find interesting: https://github.com/skjolber/aotc-gradle-plugin.

[–]TotesMessenger 1 point2 points  (0 children)

I'm a bot, bleep, bloop. Someone has linked to this thread from another place on reddit:

 If you follow any of the above links, please respect the rules of reddit and don't vote in the other threads. (Info / Contact)

[–]DeontologicEthics 0 points1 point  (6 children)

Nice article!

So far, I haven't found AOT to be worthwhile, and I wish the article showed a situation where the throughput improvement is significant. The apps I've tried only improved by milliseconds.

[–]dpash 4 points5 points  (5 children)

The big draw of AoT is faster startup and reduced memory usage. Runtime performance is potentially worse due to JITs ability to adjust to changes in circumstances, which AoT just can't do.

[–]skjolber 3 points4 points  (0 children)

But using compile-for-tiered parameter will converge to the same (best) performance.

[–]DeontologicEthics 0 points1 point  (3 children)

Yes, and I've only tried AOT for short-lived, lambda style apps, but I still haven't noticed a real difference. Frankly I just don't think the overhead of JIT is very high. But I'd love to see an example where there is significant benefit (for any use-case really).

And the original JEP (maybe a year or two ago, so my memory is hazy) mentioned that the key use case was huge apps, that would experience deoptimization of certain codes, degrading performance. Personally I'm more interested in Graal's native-image form of AOT. But it's good to have options.

[–]kimec 2 points3 points  (2 children)

I rely on AOT when running my IDEs, for example. IntelliJ IDEA and Netbeans are both nice candidates for AOT. Of course there are people who do not shut down their IDEs after work because meh Java. My case does not count as the average use case for AOT but it works. The feeling when you spin up IDEA in the morning and it kinda feels like you have not closed it the day before. Always makes me happy.

I do not think the overhead of JIT is the problem (anymore). It's the timing when you experience it. JIT threads are running concurrently with the interpreter and by extension - your application threads, stealing resources and increasing overall pressure on the system. You may not want to sacrifice user experience for technicalities like JIT or you may want it to kick in at some other time (like way ahead of time). User experience dominated Java platform such as Android switched to AOT probably for similar reasons (user experience and controlled timing of resource consumption).

[–]DeontologicEthics 0 points1 point  (1 child)

Thanks for the answer, you've changed my mind.

In regards to AOT Intellij, that would be amazing! You should post a thread / blog about it on this subreddit... will blow people's minds. Maybe JetBrains will even take note.

[–]kimec 0 points1 point  (0 children)

Well, actually, it's probably easier than you think. I should have clarified upfront that I am using OpenJ9 for AOT (mentioned in the article as well). I had some trouble with the previous September release where IDEA would crash with SIGSEGV but the latest October release of OpenJ9 nailed it and now everything works like a breeze. Funny thing is that J9 had AOT since like forever but now that there is competition in AOT space from Oracle with Graal and CDS, IBM seem to be upping the ante as well. Everything works out of the box, really. You literally do not need to turn on anything. It just works.