3 ms·
GraalVM native-image is not a listed option, but I regularly use it to produce binaries that are competitive with (often better than) Go in terms of size and (s
by lvh 7y ago
GraalVM native-image is not a listed option, but I regularly use it to produce binaries that are competitive with (often better than) Go in terms of size and (start time) perf.
A Clojure tool that parses, traverses and processes JSON (caro, see below) worked out to 3.2MB. I'm sure C and Rust can do better, but it's not bad compared to a JVM, and it's an order of magnitude better than the best option in the article. It's also small enough that while comparisons like "that's three floppies!" are interesting historical perspective, you can't reasonably complain about having a 3 MB binary in ~/.local/bin.
Examples:
https://github.com/latacora/wernicke/releases https://github.com/latacora/wernicke/releases
https://github.com/latacora/recidiffist-cli/releases https://github.com/latacora/recidiffist-cli/releases
https://github.com/latacora/caro/releases https://github.com/latacora/caro/releases
It mostly works out of the box. My biggest frustration is that you can't easily link in dynamic libraries, which makes it a little annoying to do e.g. EC TLS with a single binary. (Go would have a similar problem but sidestepped it by reimplementing most of it natively.) Second biggest frustration: it is not a fast compiler. You're definitely doing development on the JVM (I use Graal as my default JVM now) and a "production build" afterwards with native-image.
- vips7L 7y ago>I regularly use it to produce binaries that are competitive with (often better than) Go in terms of size and (start time) perf. How do they compare to go in terms of speed? Another comment also said graal native images still suffer with throughput vs using the jvm due to profile guided optimizations.
- chrisseaton 7y agoIt's still optimised native code - it's not like they're running in an interpreter. The real issue is the GC is not as efficient.