Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compilation times of long static vectors are increasing #32076

Closed
baggepinnen opened this issue May 19, 2019 · 1 comment · Fixed by #32105
Closed

Compilation times of long static vectors are increasing #32076

baggepinnen opened this issue May 19, 2019 · 1 comment · Fixed by #32105
Assignees
Labels
compiler:inference Type inference compiler:latency Compiler latency

Comments

@baggepinnen
Copy link
Contributor

I recently got my hands on the 1.3 nightly binary and noticed a huge increase in compilation time for my code using static arrays. This goes against what I've noticed for most other code, which generally compiles faster on later versions of julia.

Below is a very simple benchmark with a very long static vector. For more complicated functions, the findings are the same for vectors of more moderate lengths (50-100).

Julia 1.1.0

julia> @time sum(@SVector(zeros(5000)))
 10.153586 seconds (20.04 M allocations: 927.505 MiB, 5.88% gc time)

Julia 1.2.0-DEV.647

julia> @time sum(@SVector(zeros(5000)))
 17.940720 seconds (30.00 M allocations: 1.436 GiB, 5.17% gc time)

Julia 1.3.0-DEV.249

julia> @time sum(@SVector(zeros(5000)))
 47.005255 seconds (30.24 M allocations: 1.445 GiB, 3.44% gc time)

This is slightly worrying as I now frequently think julia has crashed when several minutes are spent on compilation, for codes which previously ran quite fast.

Ref https://discourse.julialang.org/t/compilation-times-for-long-static-vectors-are-increasing/

@KristofferC KristofferC added the compiler:latency Compiler latency label May 19, 2019
@JeffBezanson
Copy link
Member

We're spending all the time here inferring getindex(::SArray, i) where i is a constant. That, of course, will never be useful. I think we need some kind of rule to avoid constant propagating getindex of non-constant AbstractArray types. Trying a simple version of that cuts the time to <= 5 seconds.

@JeffBezanson JeffBezanson added the compiler:inference Type inference label May 20, 2019
@JeffBezanson JeffBezanson self-assigned this May 21, 2019
JeffBezanson added a commit that referenced this issue May 21, 2019
Adds some heuristics to avoid constant propagation in cases unlikely to
be useful: getindex and setindex! of non-const arrays, iterate of
non-const objects, and arithmetic with some non-const args.
JeffBezanson added a commit that referenced this issue May 22, 2019
Adds some heuristics to avoid constant propagation in cases unlikely to
be useful: getindex and setindex! of non-const arrays, iterate of
non-const objects, and arithmetic with some non-const args.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compiler:inference Type inference compiler:latency Compiler latency
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants