Faster Startup via AOT

The initial startup time of shadow-cljs can be quite slow which can be quite annoying. With a server-mode instances running thats generally not an issue but that won’t always be the case and the server instance has to be started too.

As of 2.4.28 the shadow-cljs npm package will use the a AOT compiled artifact by default when running in standalone mode.

Before

$ time shadow-cljs clj-eval 1
shadow-cljs - config: ~/test-dummy/shadow-cljs.edn  cli version: 2.4.26  node: v9.4.0
shadow-cljs - starting ...
1

real    0m8.788s
user    0m25.813s
sys     0m2.141s

After:

$ time shadow-cljs clj-eval 1
shadow-cljs - config: ~/test-dummy/shadow-cljs.edn  cli version: 2.4.28  node: v9.4.0
shadow-cljs - starting ...
1

real    0m3.556s
user    0m8.688s
sys     0m1.234s

While 3.5sec is still too slow its quite an improvement over 8.7sec.

Please try it and report if you run into any issues. I experimented with AOT in the past and it had lots of issues. The approach used this time however is much cleaner so I hope its more reliable too. You can toggle set :aot false in the shadow-cljs.edn config to use the normal artifact instead.

PS: I absolutely do not recommend using the AOT version when running embedded in lein or deps.edn but you can try it by specifying the :classifier "aot" on the dependency (eg. [thheller/shadow-cljs "2.4.28" :classifier "aot"]).

11 Likes

Thanks, speed ups are always awesome in Clojure land

2 Likes

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