Hi!
i read about reducing repl start up time during dev and tried to apply these knowledge to start REPL using Leiningen (in the article Alex shows this practice using deps.edn).
My steps:
I overrided clojure.core/load var to track time elapsed on loading module with:
(alter-var-root #'clojure.core/load (fn [origin-fn]
(if (get (meta origin-fn) ::track-load?)
origin-fn
(vary-meta (fn [& args]
(let [start# (System/nanoTime)
ret# (apply origin-fn args)
elapsed-ms# (/ (double (- (System/nanoTime) start#)) 1000000.0)]
(newline)
(pr {:args (vec args)
:ms elapsed-ms#})
(newline)
ret#))
merge
{::track-load? true}))))
I noticed that loading core clojure parts takes time ~0.10-0.20 ms and loading third party libs modules (cheshire for example) , takes ~200-400ms.
As i understand, main idea of reducing REPL start up time is the priority of compiled class before clj module if clj module was not changed. So we can compile third party libs and get benefit of not parsing their clj files but use their compiled classes.
I compiled all clojure files (my and libs) via leiningen uberjar and added folder with compiled class files to :checkout-deps-shares, i guess it is a way to add folder with class files to classpath:
:checkout-deps-shares [:source-paths :test-paths
~(fn [p] (str (:root p) "/target/uberjar/classes/*"))]
Then i restarted repl, overrided clojure.core/load to track modules load time and as experiment do following:
(time (require 'runtime.account :reload-all))
where runtime.account is one of my root modules.
As a result i cannot see any difference in loading time of third party libs modules :/.
Maybe you can give me some details about mechanism deciding to load class file or clj file and some way to monitor that activity?
Thanks!