babashka / obb

Ad-hoc ClojureScript scripting of Mac applications via Apple's Open Scripting Architecture.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Lazy loading of occasionally needed code

zane opened this issue · comments

Loading JavaScript is expensive. Definitions needed for intermittently used features like the REPL should not be read unless that feature is being used in a particular call.

$ time nbb -e '(+ 1 2 3)'
6
nbb -e '(+ 1 2 3)'   0.18s  user 0.02s system 109% cpu 0.185 total
$ time nbb -e "(require '[clojure.pprint :as pprint])"
nbb -e "(require '[clojure.pprint :as pprint])"   0.21s  user 0.02s system 107% cpu 0.213 total