<html>
  <head>
    <meta content="text/html; charset=windows-1252"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <div class="moz-cite-prefix">Le 23/03/2016 11:59, Samuel Gougeon a
      écrit :<br>
    </div>
    <blockquote cite="mid:56F27710.80407@free.fr" type="cite">
      <meta content="text/html; charset=windows-1252"
        http-equiv="Content-Type">
      <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>
    </blockquote>
    on my MacPro mid 2010 (2,8 GHz Quad-Core Intel Xeon) , with Scilab
    5.5.2:<br>
    <br>
    -->timer();for i=1:1000;sum(a(10:100000));end;disp(timer())<br>
     <br>
        1.176976  <br>
    <br>
    --> timer();for
    i=1:1000;sum(a($-n+10:$-n+100000));end;disp(timer())<br>
     <br>
        0.565811  <br>
    <br>
    and with Scilab 6.0b1:<br>
    <br>
    --> timer();for i=1:1000;sum(a(10:100000));end;disp(timer())<br>
    <br>
       1.22783<br>
    <br>
    --> timer();for
    i=1:1000;sum(a($-n+10:$-n+100000));end;disp(timer())<br>
    <br>
       0.728778<br>
    <br>
    The different ratios for different platforms are somehow
    understandable (different os, memory management, ...) but anyway
    disturbing !<br>
    <br>
    S.<br>
    <br>
    <blockquote cite="mid:56F27710.80407@free.fr" type="cite"> <br>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">_______________________________________________
dev mailing list
<a class="moz-txt-link-abbreviated" href="mailto:dev@lists.scilab.org">dev@lists.scilab.org</a>
<a class="moz-txt-link-freetext" href="http://lists.scilab.org/mailman/listinfo/dev">http://lists.scilab.org/mailman/listinfo/dev</a>
</pre>
    </blockquote>
    <br>
    <br>
    <pre class="moz-signature" cols="72">-- 
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</pre>
  </body>
</html>