I have a large-ish Clojure project that involves a lot of network servers
and background threads. It's difficult to work on a program like this by
reloading code at the REPL, because old background threads may still be
running with old code. So I end up restarting the process many times per
day.
I'm using Leiningen 2.0.0-preview3 and Apple's JDK 1.6.0_29 on Mac OS X
10.6.8.
My Leiningen project is configured to load my app in the REPL:
:repl-options {:init-ns my-project.main}
>From a clean start, `lein repl` takes 25 seconds to get to the first
prompt. That's a long time during development.
I tried pre-compiling everything by adding AOT-compilation:
:aot [my-project.main]
This is reasonable, because I'm usually only working on one source file,
trying to fix a bug, and the Clojure loader will prefer .clj files that are
more recent than their corresponding .class files.
After `lein compile`, I'm down to 14 seconds to start a REPL. Better, but
still not fast enough.
What if I omit Leiningen altogether? First, generate the classpath:
lein classpath > target/classpath
Then call Java directly:
java -cp `cat target/classpath` clojure.main -i src/my_project/main.clj
-r
This cuts startup time down to 6 seconds, but I lose all the niceties of
the Leiningen REPL.
Running Java with '-XX:+TieredCompilation' took off another half second.
Adding '-client' had no visible effect.
What other tricks do you have for speeding up your development cycle with
Clojure?
-S
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your
first post.
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en