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: Paul Thomas
Subject: Re: Slowup in 2.1.54
Date: Sun, 22 Feb 2004 16:04:05 +0100
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.2.1) Gecko/20030225

John,

I think that you are right about this being an allocator effect. Up to precisely 8192 words, the growth in time taken by the little code is linear. After that, it goes over abruptly to quadratic time dependence. The former indicates that the system is able to to reuse the previous allocation and then, beyond 64kbyte, x has to be moved, which gives the quadratice dependence.

Paul

John W. Eaton wrote:

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

| Octave does this sometimes; eg. j = | 1e4; tic;x = []; for i = 1:j; x(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]