Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Improving startup time of Clojure REPL with Leiningen on the Raspberry Pi

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?

like image 871
raju-bitter Avatar asked Dec 26 '12 11:12

raju-bitter


People also ask

Why is Clojure startup slow?

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.

Why is lein repl so slow?

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.


1 Answers

Also try grenchman: Fast invocation of Clojure code over nREPL.

like image 128
Daniel Szmulewicz Avatar answered Sep 20 '22 14:09

Daniel Szmulewicz