3 ms·
If you have been filtering out clojure due to dislike of JVM, give it a try with GraalVM either directly [1] or via Babashka [2]. GraalVM will in most cases not
by fuzzythinker 5y ago
If you have been filtering out clojure due to dislike of JVM, give it a try with GraalVM either directly [1] or via Babashka [2]. GraalVM will in most cases not only run your code much faster than JVM, but cuts startup time from seconds down to msecs [3][4], not to mention compiling to native with c api or LLVM. With Babashka, it packages a subset of GraalVM so you don't have to install that but is more limited. So if you just want to play around with clojure to see if you like it, Babashka is a great way to start.
[1] https://github.com/oracle/graal https://github.com/oracle/graal
[2] https://github.com/babashka/babashka https://github.com/babashka/babashka
[3] https://arnoldgalovics.com/java-cold-start-aws-lambda-graalvm/ https://arnoldgalovics.com/java-cold-start-aws-lambda-graalv... (large proj - dynamoDB)
[4] https://dev.to/wololock/groovy-script-startup-time-from-2-1s-to-0-013s-with-graalvm-1p34 https://dev.to/wololock/groovy-script-startup-time-from-2-1s... (small proj)
- orestis 5y agoA nitpick: Your code will not run faster in GraalVM vs the JVM, it will start faster. If its small scripts where the startup time dominates, then of course it goes faster. For anything long-lived (even in the range of tens of seconds), the JVM has better performance.
- fnordsensei 5y agoTo be fair, it might run faster as well, or not. It seems to vary from case to case.
- hiepph 5y agoI owe a lot to Babashka. Now I can use Clojure for real-job scripting instead of just playing for fun with it. For a one-liner scripting I still use Bash but for a larger script I now use Clojure.