Try running it twice. It spends time compiling the function the first time.
I get

julia> include("../../Downloads/test.jl")
elapsed time: 0.666072953 seconds (42 MB allocated, 1.12% gc time in 2
pauses with 0 full sweep)

julia> @time test()
elapsed time: 0.014324694 seconds (25 MB allocated, 28.88% gc time in 1
pauses with 0 full sweep)

2015-04-23 19:09 GMT-04:00 Stéphane Mottelet <[email protected]>:

> Hello,
>
> I am trying to improve the speed of code like this:
>
> M1_v=(v[17]
> v[104]
> v[149]
> -[v[18]+v[63]+v[103]]
> v[17]
> v[104]
> v[149]
> ...
> -[v[39]+v[41]+v[124]]
> v[38]
> v[125]
> v[127]
> -[v[39]+v[41]+v[124]);
>
> The attached file (with 1000 repetitions) runs very slowly (0.71s)
> compared to Scilab where it takes only 0.42 s on my machine. Did I miss
> something ?
>
> Thanks for your help
>
> S.
>
>

Reply via email to