[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
iterations are s l o w
From: |
Francesco Potorti` |
Subject: |
iterations are s l o w |
Date: |
Fri, 14 Jul 1995 10:56 +0100 (MET) |
I got a tenfold or some increase on a simple instructions loop by
modifying it to use matrix ranges. While I expected a speed increase,
I have the feeling that the increase is too big, and something is
wrong in the for iteration.
In the following, FBM is a 2^n+1 long column vector. The second code
does the same thing more or less 10 times quicker on an alpha (I can
time it exactly if it is important) when n is 12. With greater n, the
difference is greater yet (this is obvious, but it is too much, in my
opinion).
Is there a reason or is it a sort of "performance bug"?
##for i = 1:n
## d = 2^(n-i);
## scale = scale * 2^-H;
## for j = d+1:2*d:N-d+1
## FBM(j) = 0.5 * (FBM(j-d) + FBM(j+d)) + FBM(j)*scale;
## endfor
##endfor
for i = 1:n
d = 2^(n-i);
scale = scale * 2^-H;
range = [d+1:2*d:N-d+1];
FBM(range) = 0.5 * (FBM(range-d) + FBM(range+d)) + FBM(range)*scale;
endfor
--
Francesco Potorti` | address@hidden (Internet)
researcher at | 39369::pot (DECnet)
CNUCE-CNR, Pisa, Italy | +39-50-593203 (voice) 904052 (fax)
- iterations are s l o w,
Francesco Potorti` <=