<html>
<head>
<meta content="text/html; charset=windows-1252"
http-equiv="Content-Type">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<div class="moz-cite-prefix">Hello Stéphane,<br>
<br>
Le 23/03/2016 10:05, Stéphane Mottelet a écrit :<br>
</div>
<blockquote cite="mid:56F25C49.5060305@utc.fr" type="cite">
<meta http-equiv="content-type" content="text/html;
charset=windows-1252">
.../...<br>
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
<meta http-equiv="Content-Type" content="text/html;
charset=windows-1252">
Xeon E5-2660 v2 (2.20 GHz)
<title></title>
)<br>
<br>
--> n=200000;a=rand(n,1);<br>
<br>
--> timer();for i=1:1000;sum(a(10:100000));end;disp(timer())<br>
<br>
1.51426 <br>
<br>
--> timer();for
i=1:1000;sum(a($-n+10:$-n+100000));end;disp(timer())<br>
<br>
0.588478 <br>
<br>
almost three times faster... </blockquote>
<br>
On my PC, i get with Scilab 6.0b1 / win7_x64, in a ~reproducible way
(for the ratio) :<br>
--> timer();for i=1:1000;sum(a(10:100000));end;disp(timer())<br>
2.1996141<br>
<br>
--> timer();for
i=1:1000;sum(a($-n+10:$-n+100000));end;disp(timer())<br>
1.5756101<br>
<br>
Scilab 5.5.2 is slightly faster and the ratio is a bit more
balanced:<br>
--> timer();for i=1:1000;sum(a(10:100000));end;disp(timer())<br>
1.716011 <br>
<br>
-->timer();for
i=1:1000;sum(a($-n+10:$-n+100000));end;disp(timer())<br>
1.4196091 <br>
<br>
<br>
Samuel<br>
<br>
</body>
</html>