Open
Description
Here's a simple example:
julia> using Pkg, LinearAlgebra, StaticArrays;
julia> v = @MMatrix zeros(Float64, 5, 5);
julia> v[2, 3] = -π;
julia> v[3, 2] = π;
julia> v
5×5 MArray{Tuple{5,5},Float64,2,25}:
0.0 0.0 0.0 0.0 0.0
0.0 0.0 -3.14159 0.0 0.0
0.0 3.14159 0.0 0.0 0.0
0.0 0.0 0.0 0.0 0.0
0.0 0.0 0.0 0.0 0.0
On Julia 1.1, this compiles and runs quickly
julia> @time exp(v)
8.741098 seconds (23.58 M allocations: 983.001 MiB, 8.48% gc time)
5×5 MArray{Tuple{5,5},Float64,2,25}:
1.0 0.0 0.0 0.0 0.0
-0.0 -1.0 -2.35127e-16 -0.0 -0.0
0.0 2.35127e-16 -1.0 0.0 0.0
0.0 0.0 0.0 1.0 0.0
0.0 0.0 0.0 0.0 1.0
julia> versioninfo()
Julia Version 1.1.0
Commit 80516ca202 (2019-01-21 21:24 UTC)
Platform Info:
OS: macOS (x86_64-apple-darwin14.5.0)
CPU: Intel(R) Core(TM) i7-4870HQ CPU @ 2.50GHz
WORD_SIZE: 64
LIBM: libopenlibm
LLVM: libLLVM-6.0.1 (ORCJIT, haswell)
julia> Pkg.status("StaticArrays")
Status `~/.julia/environments/v1.1/Project.toml`
[90137ffa] StaticArrays v0.11.0 #master (https://github.com/JuliaArrays/StaticArrays.jl)
On Julia 1.0, it takes nearly 50x longer:
julia> @time exp(v)
406.894653 seconds (24.31 M allocations: 1.512 GiB, 0.31% gc time)
5×5 MArray{Tuple{5,5},Float64,2,25}:
1.0 0.0 0.0 0.0 0.0
-0.0 -1.0 -2.35127e-16 -0.0 -0.0
0.0 2.35127e-16 -1.0 0.0 0.0
0.0 0.0 0.0 1.0 0.0
0.0 0.0 0.0 0.0 1.0
julia> versioninfo()
Julia Version 1.0.4
Commit 38e9fb7f80 (2019-05-16 03:38 UTC)
Platform Info:
OS: macOS (x86_64-apple-darwin15.6.0)
CPU: Intel(R) Core(TM) i7-4870HQ CPU @ 2.50GHz
WORD_SIZE: 64
LIBM: libopenlibm
LLVM: libLLVM-6.0.0 (ORCJIT, haswell)
julia> Pkg.installed()["StaticArrays"]
v"0.11.0"
The culprit appears to be these lines
Lines 105 to 112 in e77e3ef
If I remove them and everything afterward, the function compiles and returns quickly. Also, if I interrupt the stalled command (exp(v)
) with Ctrl+C
, and then re-run the command, it runs instantly.