Why so many change types for mutable vec? #70
-
I think all vec changes can be represented as a single I was wondering why this has so many different vec change event types (push, pop, insert, etc). |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
That would be less efficient, because
|
Beta Was this translation helpful? Give feedback.
That would be less efficient, because
Vec
requires a heap allocation. The only time a heap allocation is necessary withVecDiff
is with theReplace
variant, which completely replaces all the old values with new values.VecDiff
is an internal implementation detail, so the primary goal is correctness, functionality, and performance. Simplicity is a nice bonus, but it is less important than those other goals.