~severeoverfl0w/slow-namespace-clj

d47bb92d4d485c31e6173e433d4b162209e36d36 — Dominic Monroe 1 year, 11 months ago a36e767
Speed up recursive-ns-decls

Skip already seen decls, reduces processing significantly.
1 files changed, 2 insertions(+), 2 deletions(-)

M src/io/dominic/slow_namespace_clj/core.clj
M src/io/dominic/slow_namespace_clj/core.clj => src/io/dominic/slow_namespace_clj/core.clj +2 -2
@@ 12,11 12,11 @@
        decl-idx (into {} (map (juxt parse/name-from-ns-decl identity)
                               (find/find-ns-decls (cp/classpath) find/clj)))]
    (loop [decls scan-decls
           final-decls []]
           final-decls #{}]
      (if (seq decls)
        (let [[decl & decls] decls]
          (recur
            (apply conj decls (map decl-idx (parse/deps-from-ns-decl decl)))
            (apply conj decls (remove final-decls (map decl-idx (parse/deps-from-ns-decl decl))))
            (conj final-decls decl)))
        final-decls))))