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
// modifyNow also calls the eventContext executeActiveEventsImmendiately.
74
+
// This is not necessary from event attributes, because its called at the end anyway.
75
+
numbers.modifyNow();
66
76
}
67
77
}()
68
78
);
@@ -122,4 +132,16 @@ auto foo() {
122
132
}
123
133
)
124
134
}
125
-
```
135
+
```
136
+
137
+
## Notes about the Optimization
138
+
The ranges optimization that is applied to Observed<std::vector> and Observed<std::deque> makes it so that only the changed/inserted elements are rerendered and only erased elements are removed and nothing else is rerendered.
139
+
This is done by tracking the changes using some algorithms on an interval tree.
140
+
141
+
Insertions, modifications and erasures are only ever tracked alone, so if you switch from inserting elements to modifying elements a rerender is forced.
142
+
If you erase something after modifying, all erased elements that were previously modified will not be rerendered only if the erasure happens at the end.
143
+
If you erase something after inserting, all erased elements that were previously inserted will not be rerendered only if the erasure happens at the end.
144
+
145
+
All wisdoms about modifying a vector apply to these optimizations. It is optimal to only ever add or erase from the end of the vector.
146
+
The most detrimental thing you can do is inserting at every odd position or erasing at every odd position, this will defeat the optimization and it will
0 commit comments