Le 23/03/2016 11:59, Samuel Gougeon a écrit :
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
on my MacPro mid 2010 (2,8 GHz Quad-Core Intel Xeon) , with Scilab 5.5.2:

-->timer();for i=1:1000;sum(a(10:100000));end;disp(timer())

    1.176976

--> timer();for i=1:1000;sum(a($-n+10:$-n+100000));end;disp(timer())

    0.565811

and with Scilab 6.0b1:

--> timer();for i=1:1000;sum(a(10:100000));end;disp(timer())

   1.22783

--> timer();for i=1:1000;sum(a($-n+10:$-n+100000));end;disp(timer())

   0.728778

The different ratios for different platforms are somehow understandable (different os, memory management, ...) but anyway disturbing !

S.




_______________________________________________
dev mailing list
[email protected]
http://lists.scilab.org/mailman/listinfo/dev


--
Département de Génie Informatique
EA 4297 Transformations Intégrées de la Matière Renouvelable
Université de Technologie de Compiègne -  CS 60319
60203 Compiègne cedex

_______________________________________________
dev mailing list
[email protected]
http://lists.scilab.org/mailman/listinfo/dev

Reply via email to