DataArray and VecDataArray are doing too many heap allocations
Both DataArray and VecDataArray are doing allocations/deletions in cases where its not necessary.
-
clear()
is implemented asresize(0)
which not only deletes the current memory but additionally also allocates new memory of size 1
This should probably be implemented as a constant time m_size=0
without allocations
-
resize()
for any case where the new capacity is smaller than the existing capacity also allocates new memory, this should probably be implemented as just a simple change tom_size
A change here though would impact #297 (closed) maybe other systems that rely on the internal data pointer.