Suppose I create a decently-sized persistent map, and then make a small
change. Clojure is extremely efficient at creating a second persistent map
that shares most of its internal data with the first map, but
clojure.data/diff appears to be unable to take advantage of that shared
internal data -- instead it seems to just exhaustively compare the two
trees.
Comparing a map with itself: "Elapsed time: 0.155404 msecs"
Comparing two identical -- but separately-created maps -- "Elapsed time:
43.687906 msecs"
Comparing a map and one with a small change thereof: "Elapsed time:
378.754266 msecs"
Is there a way of comparing two maps that takes advantage of the internals
of the commonality between maps "x" and "y" below?
Many thanks!!!
Marshall
(let [doDiff (fn[a b] (time
(let [delta (clojure.data/diff a b)]
[(first delta) (second delta)])))
x (into {} (map vec (partition 2 (range 100000))))
x1 (into {} (map vec (partition 2 (range 100000))))
y (assoc x -1 -1)]
[(doDiff x x)
(doDiff x x1)
(doDiff x y)])
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your
first post.
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
---
You received this message because you are subscribed to the Google Groups
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.