Added identical? optimization to diffing.
This commit is contained in:
parent
e76ded09dd
commit
9211bc8955
1 changed files with 28 additions and 26 deletions
|
@ -586,10 +586,12 @@
|
||||||
nil))
|
nil))
|
||||||
cur-child)))
|
cur-child)))
|
||||||
|
|
||||||
(defn- try-diff [parent vdom cur-dom-node top-level]
|
(defn- try-diff [parent spec vdom cur-dom-node top-level]
|
||||||
(let [cur-state (get-element-state cur-dom-node)
|
(let [cur-state (get-element-state cur-dom-node)
|
||||||
cur-tag (.-tag cur-state)
|
cur-tag (.-tag cur-state)
|
||||||
new-tag (first vdom)]
|
new-tag (first vdom)]
|
||||||
|
(if (identical? spec (.-element-spec cur-state))
|
||||||
|
cur-dom-node
|
||||||
(if (keyword-identical? new-tag cur-tag)
|
(if (keyword-identical? new-tag cur-tag)
|
||||||
(do
|
(do
|
||||||
;(println "diff hit" (first vdom))
|
;(println "diff hit" (first vdom))
|
||||||
|
@ -612,7 +614,7 @@
|
||||||
cur-dom-node))
|
cur-dom-node))
|
||||||
(do
|
(do
|
||||||
;(println "build hit" (first vdom) (first cur-vdom))
|
;(println "build hit" (first vdom) (first cur-vdom))
|
||||||
(replace-node-completely parent vdom cur-dom-node top-level)))))
|
(replace-node-completely parent vdom cur-dom-node top-level))))))
|
||||||
|
|
||||||
(declare bind-child)
|
(declare bind-child)
|
||||||
|
|
||||||
|
@ -633,8 +635,8 @@
|
||||||
(if top-level
|
(if top-level
|
||||||
(do
|
(do
|
||||||
;(println "starting diff replace")
|
;(println "starting diff replace")
|
||||||
(try-diff parent new-virtual-dom cur-dom-node top-level))
|
(try-diff parent new-elem-spec new-virtual-dom cur-dom-node top-level))
|
||||||
(try-diff parent new-virtual-dom cur-dom-node top-level))
|
(try-diff parent new-elem-spec new-virtual-dom cur-dom-node top-level))
|
||||||
|
|
||||||
(replace-node-completely
|
(replace-node-completely
|
||||||
parent new-elem-spec cur-dom-node top-level)))))
|
parent new-elem-spec cur-dom-node top-level)))))
|
||||||
|
|
Loading…
Reference in a new issue