Open
Description
When a PersistentVector<T>
is added to another PersistentVector<T>
through addAll
this can be optimized and, when the shift alligns, layers of the vector, as a whole, can be copied over instead of copying individual elements. Even if the shifts don't allgin, copyInto
can be used instead of going through the addAll
of the builder
which can avoid several otherwise unncessary allocations and virtual dispatches.
A similar technique can be used for the TrieNode
for the PersistentHashMap
but the special cases end up not being nearly as rare as it will often be the case when whole TrieNode
s can be copied from one PersistentHashMap
to another.