You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
At the moment, whenever any value changes inside the map, even if it is only the element pointed at by one of the children, there will be N comparisons performed when propagating the data to the children (each child has to check if their element did change).
This means we can implement an optimization in Lager such that it detects this particular scenario and uses immer::diff() to detect which children did change and propagate changes directly to those, ignoring the children that did not change, potentially turning O(N) into O(1) for most common UI patterns!
The text was updated successfully, but these errors were encountered:
Consider a scenario:
lager::reader<immer::map<K, V>> parent = ...; lager::reader<V> child1 = paren[k0]; lager::reader<V> child2 = paren[k1]; ... lager::reader<V> childN = parent[kN];
At the moment, whenever any value changes inside the map, even if it is only the element pointed at by one of the children, there will be
N
comparisons performed when propagating the data to the children (each child has to check if their element did change).However, Immer now supports strucutural-sharing aware diffing.
This means we can implement an optimization in Lager such that it detects this particular scenario and uses
immer::diff()
to detect which children did change and propagate changes directly to those, ignoring the children that did not change, potentially turningO(N)
intoO(1)
for most common UI patterns!The text was updated successfully, but these errors were encountered: