I tried Clojure, but the startup times were too large to the point where it became impractical. Especially for small scripts.
I tried Clojure, but the startup times were too large to the point where it became impractical. Especially for small scripts.
That said, slow startup times are only true of Clojure JVM. ClojureScript and Clojure babashka, for example, both start fast enough for small scripts.
Also, seems the JVM is slowly improving in startup time department. I was surprised to see that a hello world is now down to 800ms start time on my 2011 laptop with Java 14. It was 3s before with Java 8 on the same laptop.
For comparison, ClojureScript hello world was 550ms, and babashka hello world was 36ms. Python hello world was 68ms and Ruby was 111ms.
It's not the JVM that makes Clojure JVM slow to start up, try comparing hello world in Java vs hello world in Clojure.
So when people say that part of the slow startup is Clojure's fault, they mean more that it is implemented in a way that the JVM isn't very fast at starting. But if you look at Clojure implemented on other runtimes, like ClojureScript, the startup times are much faster, because the NodeJS runtime is much faster to start and initialize everything than the JVM is.
In effect, if the JVM improves startup times, so will Clojure JVM's startup times be improved. That's why I see this drastic difference between a Clojure hello world on Java 8 vs Java 14.
And now with things like GraalVM and Babashka you can write programs and scripts that starts in a matter of milliseconds.
Startup time was also a deterrent for me initially, but that was ~7-8years. I annoyed the heck out of me. I was doing Rails back then and that was too much too.
Nowadays however the situation is a lot better.
For scripts, you definitely should check out https://github.com/borkdude/babashka !
Startup time still annoys me, but I've learnt an practiced development enough that I'm leaving my REPLs open for days on end.
I use very few simple tricks to speed things up a bit:
I work Clojure cli tools (`deps.edn`) instead of `lein`.
Run `(compile 'my.main.namespace)` occasionally, when I add some bigger library to my project as recommended here: https://clojure.org/guides/dev_startup_time
And I think that's it.
You can further reduce this overhead if you are just using the the Socket REPL, but I think the best support for that (which allows evaluation interruption for example) is the Chlorine plugin for the Atom editor. I usually just accept the overhead of nREPL though.
Either way, for scripting uses there are tools like babashka or lumo with sub second startup times.