octave-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Slowup in 2.1.54


From: John W. Eaton
Subject: Re: Slowup in 2.1.54
Date: Fri, 20 Feb 2004 13:13:56 -0600

On 19-Feb-2004, Paul Thomas <address@hidden> wrote:

| Octave does this sometimes; eg. j = 
| 1e4; tic;x = []; for i = 1:j; (i) = i; endfor; toc  changes its spots 
| altogether when j>1e4 (I haven't checked in the source but I presume 
| that a reserve of about 8e4 bytes is being allocated?).

No, there is no reserve allocation.  I think in this case, performance
degrades rapidly because you are repeatedly allocating and copying an
array that includes just one more element each time.  Doing that 10000
times is bad, and it may also be that none of the previous allocations
can be reused, so that it ends up requiring a lot more than 80000
bytes in the end.  (The released chunks of memory are not the right
size unless the allocator is able to combine the them into something
that is useful, and there is no guarantee that it can.)

jwe



reply via email to

[Prev in Thread] Current Thread [Next in Thread]