Live data from Hacker News

GraalVM for JDK 21

medium.com

61–70 of 80 posts

Re: GraalVM for JDK 21

#61

I use Graal Native to AOT compile my JavaFX applications. It works surprisingly well.

I was considering this, working on a new javafx app for a side project. Using java 17, and generating binaries with fxlauncher/jpackage/wix is not working great imo. Any good recommendations on tooling for using the graal route? I develop on linux but most users will be on windows. It would be great to not have to use windows vm for building the binaries (but i can if needed ofcourse).

Re: GraalVM for JDK 21

#64
post #34

I've only done one project with GraalVM and I've been pretty happy with it in regards to faster startup time. I was doing stuff in Clojure. Clojure is a great language but it tends to have very slow startup times, even by JVM standards (it's not weird for a large Clojure program to take 5-6 seconds to start. Even a "hello world" can take upwards of a second or two). Graal mostly Just Worked with the standalone uberja…

What are the applications where slow startup time is such a big issue?

Without getting too involved with details (I was working for a certain company that doesn't like people talking in detail about anything I did there), I had a program that routinely started other processes. I was required to use Java or Clojure, and we had a sort of quasi-RPC thing that would spawn process on the shell, get a result, and return that result as a string. This application wasn't super performance-oriented, but it was enough to where a 5 second start time was untenable.

Re: GraalVM for JDK 21

#66

Earlier quoted context omitted.

gcj had a lot of problems beyond needing configuration of reflection metadata. It used a full reimplementation of the standard library, and it was never adopted by the wider Java community being largely just Red Hat's strategy for creating a fully open source Java implementation rather than something offering specific benefits to Java developers. In particular people thought it'd lead to faster code, but GCC was neve…

> With this new release the compiled images can not only be faster than JIT compiled Java (wow) but also use way less memory Source ?

https://news.ycombinator.com/item?id=37570719

Re: GraalVM for JDK 21

#67
post #4

GraalVM is a hugely under-appreciated piece of technology. A lot of my initial interest came from being able to blend different languages into a single runtime via the polyglot APIs, but the combination of performance, strong sandboxing support, and multi-language support has helped it emerge as a key primitive for anyone wishing to build extensible platforms without sacrificing speed, security, or developer ergonomi…

It's fascinating technology, but in my opinion too little, too late. Compiling with GraalVM is still a pain and will not work out-of-the-box without modifications for any non-trivial project. This is mostly, I believe, not GraalVM's fault, because it can only do so much within the confines of the existing ecosystem. If only AoT compilation to native code would have been taken seriously from the start, if only gcj wou…

It would be really nice if it didn't shit the bed over Swing apps.

Distributing a nonmodularized Java Swing app in 2023 is far more difficult than it should be.

Re: GraalVM for JDK 21

#68

I use Graal Native to AOT compile my JavaFX applications. It works surprisingly well.

I was considering this, working on a new javafx app for a side project. Using java 17, and generating binaries with fxlauncher/jpackage/wix is not working great imo. Any good recommendations on tooling for using the graal route? I develop on linux but most users will be on windows. It would be great to not have to use windows vm for building the binaries (but i can if needed ofcourse).

What trouble are you having with jpackage? It's easy. Anyway, in order to AOT compile your JavaFX compilation you will have to run(or test) your application with Graal's tracing agent to collect the metadata and then compile it. You can use Graal's native plugins for Gradle or Maven.

Re: GraalVM for JDK 21

#69
post #17

We tried to use it to improve AWS lambda startup times but desisted as it was a pain to use it with an existing app. It required too many tweaks as there are waay too many things that rely on reflection :( Things that broke include: JSON (de)serialization using Jackson, validations using hibernate, validator, AWS SDK, and even simpler libs like picocli... It could be quite useful for a set of simpler apps though

GraalVM has an agent you can use to run your project. It then generates the dependency file for you and you can then use that file to compile the native code.

If you use a framework like Spring Boot then you don't even need that. Just upgrade to 3+ and Jackson, Hibernate (and maybe these other APIs) should pretty much work out of the box.

Post reply on HN