[Scilab-users] Ways to speed up simple things in Scilab ?
Samuel Gougeon
sgougeon at free.fr
Fri Apr 24 13:48:15 CEST 2015
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.scilab.org/pipermail/users/attachments/20150424/c8a47350/attachment.htm>
More information about the users
mailing list