3 ms·
> moxie assumes that the program will enter from the "top" of the tree each time. [...] My suspicion is that Rust may be fast enough along with the right memoi
by danr_ 7y ago
> moxie assumes that the program will enter from the "top" of the tree each
time. [...] My suspicion is that Rust may be fast enough along with the
right memoization strategies to never worry about the time spent getting
from the root of the tree to nodes with changes.
I think there is reason to worry: consider a node with a lot of children, for example a list of many todos. Say you want to change the state of one single todo, for example marking it as done. With a top-down approach such as diffing you have to go through each child to see if it has changed. This is O(n). If you instead have components that know their position in the tree and can react to external changes, like react's Components or using hooks and useState, this can be updated in O(1).