If you profile incremental compilation where you repeately touch your source files and have it re-compile, you will see that
java.lang.ClassLoader.getResource()
appears at the top of the profile, and the primary call site is io/resource
calls in
cljs.util/ns->source
.
If you look at the call patterns, lots of calls are made with ns of goog.*
, and this always returns nil
. On the other hand,
there are calls for namespaces that won't change.
Re-writing this to short-circuit goog.*
to return nil
, and to cache "core" namespaces, eliminates ClassLoader.getResource()
from the top of the profile. It also seems to speed up my incremental compile loop by perhaps 5–10%.