trptcolin / reply

REPL-y: A fitter, happier, more productive REPL for Clojure.
Eclipse Public License 1.0
337 stars 44 forks source link

Defer the loading of reply.parsing namespace for faster startup #179

Closed alexander-yakushev closed 6 years ago

alexander-yakushev commented 6 years ago

While I was working on the blogpost about long Clojure start times I noticed that REPLy (which is used by Leiningen and Boot both) eats up a considerable percentage of total load time.

In particular, reply.parsing namespace, which transitively loads sjacket and other libraries, stood very distinctively. I saw it as an opportunity to defer the loading of this namespace until the user enters their very first form into the REPL. This pull request makes reply.parsing be loaded in background to wait less.

After the patch, I got a consistent ~2 seconds improvement when loading reply.main. E.g.:

;; 0.3.8
user=> (time (require 'reply.main))
"Elapsed time: 4082.037985 msecs"

;; Patched
user=> (time (require 'reply.main))
"Elapsed time: 2170.414554 msecs"
bbatsov commented 6 years ago

Nicely done! 👍

trptcolin commented 6 years ago

Awesome, thanks! 🎉