Created
January 13, 2016 14:16
-
-
Save Gnimuc/e01cd9423bb0a0f66c24 to your computer and use it in GitHub Desktop.
[SO]Julia vs MATLAB: Why is my Julia code so slow?
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using Dierckx | |
function foo() | |
x = [0., 1., 2., 3., 4.] | |
y = [-1., 0., 7., 26., 63.] | |
spl = Spline1D(x, y) | |
a = evaluate(spl, ones(10000)) | |
reshape(a,100,100) | |
end | |
function bar() | |
for i=1:1000 | |
foo() | |
end | |
end | |
@time bar() |
julia> @time bar()
0.492527 seconds (18.00 k allocations: 155.274 MB, 2.68% gc time)
julia> versioninfo()
Julia Version 0.4.2
Commit bb73f34 (2015-12-06 21:47 UTC)
Platform Info:
System: Darwin (x86_64-apple-darwin13.4.0)
CPU: Intel(R) Core(TM) i5-3210M CPU @ 2.50GHz
WORD_SIZE: 64
BLAS: libopenblas (USE64BITINT DYNAMIC_ARCH NO_AFFINITY Sandybridge)
LAPACK: libopenblas64_
LIBM: libopenlibm
LLVM: libLLVM-3.3
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Matlab code