When we've polled Leiningen users in the past[1], the #1 pain point
people always report is its startup time. While there have been a number
of strategies suggested to reduce the annoyance of slow JVM startup time
and project loading, keeping your JVMs around can lead to awkward
workflows in some situations given the tooling we've had so far.

To this end I'm happy to announce the release of Grenchman, a tool for
executing Clojure code in a running process *quickly*:

    http://leiningen.org/grench.html

With Grenchman you can launch an nREPL server in the background
(typically with `lein trampoline repl :headless`, but you can also embed
an nREPL server in a production setting) and then connect to it directly
From the command-line with minimal overhead:

    $ time grench eval '(println "Hello, world!")'
    Hello, world!

    real    0m0.117s
    user    0m0.024s
    sys     0m0.024s

This opens up a number of new command-line-centric workflows.

You can also invoke Leiningen tasks from Grenchman if you launch a
separate out-of-project `lein repl :headless` server:

    $ time grench lein version
    Leiningen 2.3.3 on Java 1.6.0_27 OpenJDK 64-Bit Server VM
    real    0m0.118s
    user    0m0.032s
    sys     0m0.020s

Finally, Grenchman includes its own interactive nREPL client using GNU
Readline:

    $ grench repl
    user=> (System/getProperty "user.dir")
    "/home/phil/src/syme"
    [...]

Plans for the next version[3] include completion in the repl client and
support for repl history and multi-line form input. While it is a very
young project, the non-interactive functionality is quite stable.

Please give Grenchman a try if this sounds interesting to you. The
install process is the same as Leiningen where you download and chmod an
executable, except that there is a different executable for different
platforms; I have precompiled binaries for several common platforms at
the link above and will post user-contributed builds for other platforms
I don't have access to if there is demand.

thanks,
Phil

[1] - https://lein-survey-2013.herokuapp.com/results and
    https://lein-survey-2012.herokuapp.com/results

[2] - https://github.com/technomancy/leiningen/wiki/Faster

[3] - https://github.com/technomancy/grenchman/issues?milestone=2&state=open

[4] - Grenchman was inspired to a degree by Jark
    (http://icylisper.github.io/jark/) but does not share any code with it.

[5] - Timings above are taken from my 4½-year-old laptop; newer hardware
    would perform better.

Attachment: pgpNvXSLf_8X1.pgp
Description: PGP signature

Reply via email to