This is a very simple optimization around {{transient []}}. It avoids copying the empty array.
Performance improvements, for {{mapv}} on smallish vectors (5-32) elements anywhere from 20% up to 100% across FF & Chrome.
(defn faster-editable-root
[node]
(if (identical? (.-EMPTY_NODE PersistentVector) node)
(VectorNode. (js-obj) (make-array 32))
(VectorNode. (js-obj) (aclone (.-arr node)))))
(def orig-editabe-root tv-editable-root)
(enable-console-print!)
(dotimes [_ 2]
(doseq [size [5 10 40]]
(let [xs (range size)
sims 500000]
(set! tv-editable-root orig-editabe-root)
(prn "Size: " size)
(simple-benchmark [] (mapv inc xs) sims)
(set! tv-editable-root faster-editable-root)
(prn "NEW:")
(simple-benchmark [] (mapv inc xs) sims))))