Explicitly bypass resize and memmoves when there is already the exact right number of elements available.

This commit is contained in:
Gael Guennebaud 2019-10-08 21:44:33 +02:00
parent 36da231a41
commit 196de2efe3

View File

@ -164,7 +164,7 @@ public:
} }
else else
{ {
if(m_matrix.isCompressed()) if(m_matrix.isCompressed() && nnz!=block_size)
{ {
// no need to realloc, simply copy the tail at its respective position and insert tmp // no need to realloc, simply copy the tail at its respective position and insert tmp
matrix.data().resize(start + nnz + tail_size); matrix.data().resize(start + nnz + tail_size);