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

浪子不回头ぞ 提交于 2019-12-12 08:19:32

问题


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?


回答1:


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




回答2:


You can try drip which wraps the java command and prepare a fresh jvm waiting in the background.




回答3:


It seems the slow startup of clojure in general is the loading of core and various other things discussed here:

http://blog.ndk.io/solving-clojure-boot-time.html




回答4:


Actually the Leiningen starts in it's own JVM and then nests the project's vm inside it.
Then it checks deps, figures out the changes and so on.

You can avoid vm nesting with the trampoline task of lein like so:
lein trampoline repl

But this command requires the lein to be called in a project directory



来源:https://stackoverflow.com/questions/14040196/improving-startup-time-of-clojure-repl-with-leiningen-on-the-raspberry-pi

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!