JuliaArrays / JuliaArrays/StaticArrays.jl

Performance bug in compiling functions

Open
#937 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

compile-time-performance
Dominant language
Julia
Stars
844
Forks
159
Avg merge
3d 21h
Merged PRs (30d)
3

Description

With Julia 1.7 and the StaticArrays v0.12.5:

julia> N = 14; m = SMatrix{N,N}(rand(N,N));

julia> x->x*m # works fine
#1 (generic function with 1 method)

julia> @time [x->x*g for g∈[m]]
  3.018892 seconds (57.49 k allocations: 3.383 MiB, 100.06% compilation time)
1-element Vector{var"#20#22"{SMatrix{14, 14, Float64, 196}}}:
 #20 (generic function with 1 method)

Why does it take 3 seconds? It seems to scale horribly, too: for N=10, I get 0.449260 seconds; for N=15, 5.230108 seconds; for N=16, 9.209356 seconds.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the example on Julia 1.7 with StaticArrays v0.12.5, starting with the @time [x->x*g for g∈[m]] case. Compare compilation time and allocations as N increases from 10 to 16, and trace the relevant StaticArrays compilation path. Done means identifying why this expression scales poorly and documenting or resolving the performance regression.

Written by the indexing model from the issue text.

Assessment

Tech stack
julia
Domain
performance
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.