another perf enhancement

This commit is contained in:
Nathan Marz 2016-09-01 23:20:53 -04:00
parent dc6740d9dc
commit 1d52e970a0

View file

@ -257,16 +257,28 @@
(set-cell! cell ret) (set-cell! cell ret)
ret)) ret))
;; TODO: this used to be a macro for clj... check if that's still important #?(
(defn compiled-traverse* [path result-fn structure] :clj
(exec-select* (defmacro compiled-traverse* [path result-fn structure]
path `(exec-select*
[] ~path
structure []
(fn [vals structure] ~structure
(if (identical? vals []) (fn [vals# structure#]
(result-fn structure) (if (identical? vals# [])
(result-fn (conj vals structure)))))) (~result-fn structure#)
(~result-fn (conj vals# structure#))))))
:cljs
(defn compiled-traverse* [path result-fn structure]
(exec-select*
path
[]
structure
(fn [vals structure]
(if (identical? vals [])
(result-fn structure)
(result-fn (conj vals structure)))))))