Skip to content

Pardiff upgrade

Athan Clark requested to merge athan.clark/Shpadoinkle:pardiff-upgrade into master

The following improvements have been made over the previous pardiff implementation:

  • Avoid using align, and rather use Map.difference and Map.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 to liftJSM, and rather performing as much IO-related actions as possible without traversing an effect stack.
  • Applied strictness and {-# UNPACK #-} pragma to Text 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 a MVar (Maybe a) rather than Data.Once's MVar (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.

Screenshot_from_2021-02-24_16-33-50

Merge request reports