Matt-Esch / virtual-dom

A Virtual DOM and diffing algorithm
MIT License
11.66k stars 779 forks source link

vtree/diff: combine unhook and destroyWidget to use a single walk #446

Closed nishanths closed 5 years ago

nishanths commented 6 years ago

I was reading this over the weekend and came across the following TODO in clearState, which seemed like a worthwhile thing to address.

// TODO: Make this a single walk, not two
unhook(vNode, patch, index)
destroyWidgets(vNode, patch, index)

However, I have no context on whether this change will result in a measurable performance improvement. I'm happy to add benchmarks, if necessary.

nishanths commented 6 years ago

One of the commits in this branch, 269cccb, is from #447. I can rebase this branch once #447 is merged.

coveralls commented 6 years ago

Coverage Status

Coverage decreased (-0.04%) to 97.491% when pulling 8e9d942af1966a887ff6582dbe146921a7d1268a on nishanths:nishanths/walk into 947ecf92b67d25bb693a0f625fa8e90c099887d5 on Matt-Esch:master.

coveralls commented 6 years ago

Coverage Status

Coverage decreased (-0.04%) to 97.491% when pulling 8e9d942af1966a887ff6582dbe146921a7d1268a on nishanths:nishanths/walk into 947ecf92b67d25bb693a0f625fa8e90c099887d5 on Matt-Esch:master.