Pardiff upgrade
The following improvements have been made over the previous pardiff implementation:
- Avoid using
align
, and rather useMap.difference
andMap.differenceWith
when patching properties. - Avoid using
align
, and rather perform a bulk node removal when patching children (individual calls to.appendChild()
is still retained and has better performance - suspected cause is that it allows for better interleaved GC). - Avoid usage of lens library when performing DOM operations (related to #80, but doesn't solve it).
- Avoid conditional setting of properties by first checking their equality with
strictEqual
- there were many cases where it was applied to the initial creation of the DOM node, or where the equality was already tested in pure Haskell. - Perform
JSM
operations as closely together as possible - refraining from redundant calls toliftJSM
, and rather performing as much IO-related actions as possible without traversing an effect stack. - Applied strictness and
{-# UNPACK #-}
pragma toText
information - minor, but consistent speed / memory improvement.
The following were attempted, but worsened performance:
- Attempted to use the io-memoize library as a replacement for
Data.Once
module defined - internally uses aMVar (Maybe a)
rather than Data.Once'sMVar (IO a)
. - Attempted to use
.append()
function to bulk-insert DOM nodes, but for large sets of nodes, performance was worse. Maybe there could be a threshold in the future, where paging or other techniques could improve performance.
The attached screenshot highlights this MR's test results compared to other branches and backends - the only other branch in question is the furthest to the right; it is the upstream results for pardiff.