I'm using lein repl
to execute clojure repl in console.
When I run it, it takes over 15 seconds.
When I run java -cp clojure-1.6.0.jar clojure.main
, it takes just a few seconds.
Why is lein repl
so slow? Are there anyways to make it faster?
My env:
Leiningen starts two JVMs, and hooks them together. It's got to load extra stuff to do that. The prompt you type into is a different process from the Clojure process that evaluates your code. Leiningen also has to parse your project file and make sure that everything is set up as it requires, or go and get what's needed from the web if there's anything missing in your maven configuration directory. In the Leiningen sample project file there are some options that can speed up things a little bit, if you read through it carefully. I think that Leiningen having slow startup is just one of the facts of life right now.
More relevant information:
Improving startup time of Clojure REPL with Leiningen on the Raspberry Pi
Faster
If you run lein repl
from within a project directory, it will load your project's source files in addition to starting a repl. Even for a small project, this can add significant time if your source files reference external dependencies.
java -cp clojure-1.6.0.jar clojure.main
won't load any project source files or dependencies.
There are multiple ways to improve the startup time off lein. Documented here:
https://github.com/technomancy/leiningen/wiki/Faster
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With