help-octave
[Top][All Lists]
Advanced

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

Re: indexing expression performance


From: Jaroslav Hajek
Subject: Re: indexing expression performance
Date: Tue, 13 Jan 2009 20:36:40 +0100

On Tue, Jan 13, 2009 at 7:13 PM, Nicholas Tung <address@hidden> wrote:
> I've noticed that indexing expressions on large arrays can be quite slow,
> even if the indexes are mostly sequential. In the code below, the first loop
> takes 1.91 seconds while the second takes 0.11 seconds. Any suggestions on
> how to get around this would be much appreciated, even looking at Octave's
> source.
>
> a = rand(300);
> tic
> for i = 1:100
>     a(1:(size(a, 1) - 1), :) += a(2:size(a, 1), :);
> endfor
> toc
>
> tic
> for i = 1:100
>     a += a;
> endfor
> toc
>
> thanks,
> Nicholas
>

What version of Octave's sources did you use? Dense indexing speed has
been vastly improved in the development sources (but after 3.1.51,
IIRC).



-- 
RNDr. Jaroslav Hajek
computing expert
Aeronautical Research and Test Institute (VZLU)
Prague, Czech Republic
url: www.highegg.matfyz.cz


reply via email to

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