Since all Gren functions are pure we have a guarantee that the same input
will always result in the same output. This module gives us tools to be lazy
Svg that utilize this fact.
Rather than immediately applying functions to their arguments, the
functions just bundle the function and arguments up for later. When diffing
the old and new virtual DOM, it checks to see if all the arguments are equal.
If so, it skips calling the function!
This is a really cheap test and often makes things a lot faster, but definitely benchmark to be sure!
A performance optimization that delays the building of virtual DOM nodes.
(view model) will definitely build some virtual DOM, perhaps a lot of
(lazy view model) delays the call until later. During diffing, we
can check to see if
model is referentially equal to the previous value used,
and if so, we just stop. No need to build up the tree structure and diff it,
we know if the input to
view is the same, the output must be the same!
lazy but checks on two arguments.
lazy but checks on three arguments.
lazy but checks on four arguments.
lazy but checks on five arguments.
lazy but checks on six arguments.
lazy but checks on seven arguments.
lazy but checks on eight arguments.