I recently discovered Julia and I have compiled it from source today and have been playing around with it since. I have this very simple script where I time the multiplication of two random matrices
julia_matmul.jl
N = 100
A = rand(N, N)
B = rand(N, N)
tic()
A*B
toc()
If I run this script twice from a Julia interactive session, then the second run is considerably faster than the first. However if I run the script twice from a terminal I only get the slowest result.
Here are my results:
$ julia julia_matmul.jl
elapsed time: 0.315129296 seconds
$ julia julia_matmul.jl
elapsed time: 0.307094268 seconds
$ julia -q
julia> include("julia_matmul.jl")
elapsed time: 0.306266193 seconds
julia> include("julia_matmul.jl")
elapsed time: 0.000700495 seconds
The overhead is about 0.3 seconds and although this is very small it can screw up the timings of short scripts. So my question is: where is this ~0.3 seconds overhead coming from and how can I get rid of it (especially when not using an interactive session)?