Skip to content

Compare: Faster

New page
Showing with 20 additions and 1 deletion.
  1. +20 −1 Faster.md
21 changes: 20 additions & 1 deletion Faster.md
Expand Up @@ -2,7 +2,8 @@ Part of what makes Leiningen's boot take a while is the fact that
Leiningen's code is completely isolated from project code. This means
that two JVMs are necessary to complete any task that has to execute
anything in the project: one for Leiningen itself, and a subprocess
for the project. There are various strategies to address this:
for the project. There are various strategies to address this. Some of
them can provide cumulative benefit, while some are mutually exclusive.

## Don't Exit

Expand Down Expand Up @@ -85,6 +86,24 @@ not the project JVM. If Leiningen determines there's no project nREPL
server to connect to it will fall back to launching a subprocess. Note
that it does not stack with fast trampolines.

## Avoiding nREPL with clojure.main

A good portion of the delay involved in getting a repl up comes from
launching a `tools.nrepl` server. Clojure ships with its own primitive
repl, that lacks fancy features but still gets the basics done. In
cases were you're already using fast trampoline (see above), using the
`clojure.main` repl instead of nREPL can boost launch time by a factor
of up to 5x:

$ LEIN_FAST_TRAMPOLINE=y lein trampoline run -m clojure.main
Clojure 1.6.0
user=>

Note that this is not compatible with nrepl-based tools like cider or
grenchman. It also lacks tab completion and line editing. The latter
can be addressed using `rlwrap` or by running it inside Emacs using
`M-x shell` or `inferior-lisp`.

## Drip

[Drip](https://github.com/flatland/drip/) is a script intended to speed up JVM start times. Installation details and an explanation of how Drip works are in the [Drip Readme](https://github.com/flatland/drip/blob/develop/README.md). Leiningen will make use of a Drip installation if the LEIN_JAVA_CMD environment variable is set to the location of the drip script.
Expand Down