Le 24/04/2015 13:36, Samuel Gougeon a écrit :
Hello Stephane,

You can speed up by a factor larger than 100 just by calling v once (or 3 times) instead of ~1000, as shown by this test:

Actually, to be more accurate, the right comparative test is the following:

function  test2()
    v  =  rand(172,1);
    p  =  grand(1,839,"unf",1,173)
    // Part 1: 1 call to v()
    tic()
    for  i=1:1000
        m1_v  =  v(p)
    end
    disp(toc())
// Part 2 : 839 calls to v()
    deff("test3()",  "for i=1:1000, M1_v = ["+strcat("v("+string(p)+")")+"], 
end")
    tic()
    test3()
    disp(toc())
endfunction

In this version, the compilation time used by execstr() is no longer taken into account.

The results are still explicit:
-->test2()

    0.016

    0.78

So, a speed-up by ~x 50

Samuel

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

Reply via email to