by didibus · 8y ago · 0 comments
I think a lot of people are wrongly under the impression that the JVM is complicated, and annoying to use. It is not, Java is. Java is not the JVM, and in the context of Clojure and ClojureScript, the JVM is amazing.
The only reason not to use the JVM I'd say would be cases where you need sub-second start times, or you have memory and space constraints, or need full real time. Though for the latter two, there exist paid JVMs that can work for those use cases. In fact, that's another amazing thing about the JVM, its a standard, and there exist multiple fully functional implementations.
Some benefits of the JVM are its very complete standard library, as well as its gigantic set of third party libs. It runs on almost any imaginable hardware. It is extremely fast. All other VMs or even VMless GC runtimes benchmark themselves against it because its the known performance champion. It has amazing GCs, it even has more then one type of GC. It supports multiple programming languages, such as Clojure. It comes with top notch tooling support for debugging, profiling and monitoring. Finally, its backed by a lot of money, which means it keeps improving quickly. Some of its soon to be improvements are complete modularity, AOT compilation, faster startup time, smaller memory footprint, ability to call native code and use native data and finally support for first class fibers (like erlang and go threads).
But seriously completely agree with you about the jvm being awesome. However clojure var load times on top of the base jvm and memory use makes it dog slow to start a development repl(30+ seconds is normal.. queue comment about how someone only restarts their repl every couple of days LOL) and unsuitable or unusable for situations where you care about app start times of less than 10 seconds and memory constrained environments such as cli, iot, serverless, android.
$ time clj -e '(System/exit 0)'
clj -e '(System/exit 0)' 1.60s user 0.07s system 198% cpu 0.839 total
It takes about 2 seconds to start for me.In this case I suspect cursive is fast because:
* You have a JVM loaded in the form of IntelliJ * You only need to start Clojure inside that JVM (which is reduced from the time clj takes!)
So 1 second is a reasonable time from IntelliJ=>Clojure. 2 seconds is reasonable for Nothing=>Clojure.
The (Clojure) "JVM Slow Startup Time" Myth