I’m trying to squeeze execution time on a script avoiding useless big-matrix reallocation.
An operation like
B = A;
causes little overhead since B will point at the same structure of A, and Matlab won’t allocate a new one until an update occurs.
But what about an operation like this?
longVector = longVector(1:n);
Will it simply update longVector structure to point to the already existing subset of datas or (more time expensive) will it cause to allocate a new vector and trash the old one?
Yes it will shrink the allocated block, but it will lead to fragmentation (on a Windows system) over time.