I got a Rasperry Pi 512 MB version (late 2012) and installed the Developer Preview of Java SE 8 for ARM on it. When I create a new Clojure project with Leiningen and launch the nREPL by doing lein repl
it takes a bit more than two minutes (roughly 130 - 140 seconds) until the REPL has been initialized and can be used.
When launching the JAR file directly java -jar clojure-1.4.0/clojure-1.4.0
the REPL starts up in 25s.
I'm using fast class 10 SD cards (SanDisk Extreme with up to 30 MB/s). How come that the difference between using Leiningen with nRepl vs launching the JAR file is so big? What could be done to improve the startup time with Leiningen for the Raspberry Pi?
Clojure projects are slow to start not only because of Clojure — Clojure itself starts in ~1 second — but because of Clojure specifics, the namespaces, especially not AOT-compiled one, are loaded slowly.
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.
Also try grenchman: Fast invocation of Clojure code over nREPL.
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