3 ms·
There are ways around the slow startup of Clojure such as http://leiningen.org/grench.html http://leiningen.org/grench.html
by justinhj 10y ago
There are ways around the slow startup of Clojure such as
http://leiningen.org/grench.html http://leiningen.org/grench.html
- klibertp 10y agoFrom that website: > Grenchman lets you run Clojure code quickly. By connecting to a running nREPL server you avoid JVM startup time, streamlining your development workflow. It's irritating to see the same claim repeated again and again. It's not JVM startup time, it's Clojure startup time. Whether it's because JVM is ill-suited for the kind of code Clojure uses or for other reasons I don't know, but JVM itself starts up 100x faster than Clojure on JVM. Moreover, a daemon running in the background is a just a workaround. To use it you need to write your app in a certain way so that reloading works, and you still need to start the daemon at some point. I've been working with Clojure for a few months full-time and it was kind of ok, however, for command line utilities, almost anything is better than Clojure. Python, JS with Node, Racket, Ruby, GNU Smalltalk, even Io - all these start up much faster than Clojure. ClojureScript with Node would be an option, but then ClojureScript (and Node). In short: if you need to write a cmd line utility program you should avoid Clojure as much as possible.
- xavi 10y agoI don't agree. Planck (https://github.com/mfikes/planck https://github.com/mfikes/planck) is quick and great for command line utilities written in ClojureScript. It runs on macOS' built-in JavaScriptCore. There's also an alpha version that runs on Ubuntu. Please check the Planck User Guide's section on Scripts http://planck-repl.org/scripts.html http://planck-repl.org/scripts.html
- justinhj 10y agoThere are a few solutions for scripting with Clojure http://blog.fikesfarm.com/posts/2015-08-01-planck-scripting.html http://blog.fikesfarm.com/posts/2015-08-01-planck-scripting.... Personally I wouldn't script in Clojure. If something is simple enough to be a script I'd use bash or Python and leave Clojure for writing non-trivial programs for which startup time is not an issue