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: Wed, 18 Feb 2004 13:20:33 -0600

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

| Whilst it is a bit at right angles to the discussion because the fault 
| with the [] operator was fixed, should we really worry about constructs 
| like
| 
| j = 1e 4; tic; x = []; for i=1:j; x = [x, i]; endfor; toc
| 
| that have square law scaling with the length of i?  
| 
|  j = 1e4; tic; x = zeros(1, j); for i = 1:j; x(i) = i; endfor; toc
| 
| is 30 times faster, at j=1e4, and is linear in j.

It's true that you shouldn't be using the first form if you can avoid
it, but the fact that it was so much slower going from 2.1.53 to
2.1.54 showed that the run time was not completely dominated by
reallocating memory.  So I think it would also mean that we would have
also seen a big drop in performance for the [] operator with a large
number of elements.

jwe



reply via email to

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