3 ms·
Could this be used for Clojure as well?
by kermatt 6mo ago
Could this be used for Clojure as well?
- gigatexal 6mo agoIdk, would be really interesting if it could. I have been wanting to get into Clojure.
- geokon 6mo agoit's used extensively Babashka, which is Clojure for scripting, is the Small Clojure Interpreter compiled to a native executable That said, it does limit you a little b/c with Graal native you need to tell the compiler if you will dynamically use a type/class (so it can't be inferred during compilation). The compiler is doing what JS people call "tree shaking" to strip unused code. (dead code elimination in C++ terms) As I understand it you have some annotation file so you don't eliminate too much, similar to using Proguard. So it's mostly plug-n-play but with some caveats
- SureshG 6mo agoNew GraalVM project Crema now supports runtime class-loading. Here's a full Clojure runtime built with GraalVM native-image + Crema: https://github.com/borkdude/cream https://github.com/borkdude/cream
- geokon 6mo agoOh wow, that's really impressive Though to my mind the correct solution would be to launch a program + VM, then freeze/store the program state. Then you could just memcopy+execve the program and immediately skip all the initialization (after a bit of Googling it seems this isn't a new idea haha, and it's in the JVM roadmap with Project Leyden. Should come out in maybe JDK 27 and make a lot of this stuff obsolete)