octave-maintainers
[Top][All Lists]
Advanced

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

Speed reduction of 2.1.48 wrt 2.1.36 for structures


From: John W. Eaton
Subject: Speed reduction of 2.1.48 wrt 2.1.36 for structures
Date: Wed, 28 May 2003 15:35:38 -0500

On 26-May-2003, David Bateman <address@hidden> wrote:

| Working to trying and find out why someones code here ran substantially
| slower under the new versions of octave. The problem was isolation to 
| the accessing of stuctures within for loops. Consider the code
| 
| x.a = 1;
| x.b = 1;
| xa = x.a;
| xb = x.b;
| tic; for i=1:10000, y.a = x.a(x.b); endfor; toc
| tic; for i=1:10000, ya = xa(xb); endfor; toc
| 
| x.a = ones(1,1024);
| x.b = 1:1024;
| xa = x.a;
| xb = x.b;
| tic; for i=1:1000, y.a = x.a(x.b); endfor; toc
| tic; for i=1:1000, ya = xa(xb); endfor; toc
| 
| 
| Under 2.1.36 on my machine I get the results
| 
| ans = 0.31809
| ans = 0.22774
| ans = 0.20027
| ans = 0.19229
| 
| Under 2.1.48 I get
| 
| ans = 0.67814
| ans = 0.26059
| ans = 0.28205
| ans = 0.23896
| 
| As can be seen the first test where there is little vectorization, thhe
| accessing of the structures is substantially slower under the recent versions
| of the code. The tests above were run on the same machine and config
| flags (eg math libraries etc)..

At some point (I don't know the precise version numbers or dates, but
you could figure this out from the ChangeLogs, I suppose), structures
were modified to be structure arrays instead.  So now there is some
extra overhead for scalar structures.  Perhaps that accounts for the
difference.

jwe



reply via email to

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