Make development startup time faster

Often the Clojure community survey receives many requests for faster startup time. There are however several distinct startup time use cases. One of those most frequently mentioned is development startup time (whether that’s starting a repl that loads a user.clj or running a dev web server).

It is not widely appreciated how easy it is to use Clojure’s existing mechanisms to AOT compile your startup dependencies and use them while you develop, shaving 10s of seconds off of every start. So, I wrote a guide on how to do this:

https://clojure.org/guides/dev_startup_time

I am certain there is a lot that can be done in frequently used templates to leverage this idea and I would encourage any toolsmiths/template makers out there to do so! It requires no changes to Clojure itself, very few changes to how you work, and you can leverage it right now.

There are of course, other use cases (lambda/serverless, production servers, etc). The core team continues to evaluate a range of options on those.

25 Likes

If you find it useful, a demo: https://github.com/puredanger/startup-time

1 Like

awesome, having tested, about 4 times faster than previous.

$ time clj -A:dev -e nil
clj -A:dev -e nil  25.70s user 0.75s system 372% cpu 7.100 total
$ clj -A:dev -e "(binding [*compile-files* true] (require 'user :reload-all))"
$ time clj -A:dev -e nil
clj -A:dev -e nil  6.70s user 0.39s system 278% cpu 2.545 total

can this work with leiningen?

1 Like

Conceptually, absolutely, but I have not done the work to develop that recipe.

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.