The mechanism Elm uses to avoid re-computing on every state change is Html.lazy
(and lazy2
, and so on, if there are more args). If the inputs have not changed, there is no need to recompute, and a whole section of the DOM can be carried over from the previous state. Its something you have to explicitly add to your code, rather than an automatic compiler optimisation, but its usually pretty easy to do so if you need it.