cjohansen / replicant

A native ClojureScript virtual DOM renderer - render hiccup directly
222 stars 10 forks source link

Store fully processed old vdom between renders for faster re-renders #10

Closed cjohansen closed 11 months ago

cjohansen commented 11 months ago

This PR trades some memory for re-rendering speed, by storing the fully realized "vdom", along with the original hiccup (e.g. everything is basically kept twice). This can be used to great effect during rendering, as Replicant can know whether a mismatching node has moved, was deleted, or is new without performing any searches through potentially big collections.

This brings all of Replicant's benchmarks into an acceptable range, while pushing memory usage a little high for some cases. I'm not 100% convinced this is the best approach, but will try to polish it from here.