Skip to content

Commit

Permalink
#748: fast, no alloc path for diffing equal objects
Browse files Browse the repository at this point in the history
Signed-off-by: Stuart Halloway <stu@thinkrelevance.com>
  • Loading branch information
stuarthalloway committed Mar 2, 2011
1 parent 0983c8a commit 1aeb592
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/clj/clojure/data.clj
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@
[things-only-in-a things-only-in-b things-in-both].
Comparison rules:
* For equal a and b, return [nil nil a].
* Maps are subdiffed where keys match and values differ.
* Sets are never subdiffed.
* All sequential things are treated as associative collections
Expand All @@ -114,7 +115,9 @@
an atom and compared for equality."
{:added "1.3"}
[a b]
(if (= (equality-partition a) (equality-partition b))
(diff-similar a b)
(atom-diff a b)))
(if (= a b)
[nil nil a]
(if (= (equality-partition a) (equality-partition b))
(diff-similar a b)
(atom-diff a b))))

0 comments on commit 1aeb592

Please sign in to comment.