Hello Stéphane,
Le 23/03/2016 10:05, Stéphane Mottelet a écrit :
.../...
This means that Scilab handles 1:10 as any other vector of
scrambled/duplicate indices without seeing that all the components are
contiguous in memory. In fact, this behavior is a major bottleneck, as
illustrated in the following (Scilab 5.5.2 timings on a Xeon E5-2660
v2 (2.20 GHz) )
--> n=200000;a=rand(n,1);
--> timer();for i=1:1000;sum(a(10:100000));end;disp(timer())
1.51426
--> timer();for i=1:1000;sum(a($-n+10:$-n+100000));end;disp(timer())
0.588478
almost three times faster...
On my PC, i get with Scilab 6.0b1 / win7_x64, in a ~reproducible way
(for the ratio) :
--> timer();for i=1:1000;sum(a(10:100000));end;disp(timer())
2.1996141
--> timer();for i=1:1000;sum(a($-n+10:$-n+100000));end;disp(timer())
1.5756101
Scilab 5.5.2 is slightly faster and the ratio is a bit more balanced:
--> timer();for i=1:1000;sum(a(10:100000));end;disp(timer())
1.716011
-->timer();for i=1:1000;sum(a($-n+10:$-n+100000));end;disp(timer())
1.4196091
Samuel
_______________________________________________
dev mailing list
[email protected]
http://lists.scilab.org/mailman/listinfo/dev