JuliaDiff / JuliaDiff/ForwardDiff.jl
Bad compilation time with static arrays and intervals
Open
Nobody has claimed this yet.
- Dominant language
- Julia
- Stars
- 1k
- Forks
- 160
- PR merge metrics
- No merged PRs in 30d
Description
The following should be a simple calculation, but uses 2GB (!) in the compilation process...:
julia> using ForwardDiff, StaticArrays, IntervalArithmetic
julia> f(x) = 2 .* x .* x
f (generic function with 1 method)
julia> X = @SVector [0..1 for i in 1:6];
julia> @time ForwardDiff.jacobian(f, X)
11.818110 seconds (67.27 M allocations: 2.401 GiB, 13.76% gc time, 100.00% compilation time)
6×6 SMatrix{6, 6, Interval{Float64}, 36} with indices SOneTo(6)×SOneTo(6):
[0, 4] [0, 0] [0, 0] [0, 0] [0, 0] [0, 0]
[0, 0] [0, 4] [0, 0] [0, 0] [0, 0] [0, 0]
[0, 0] [0, 0] [0, 4] [0, 0] [0, 0] [0, 0]
[0, 0] [0, 0] [0, 0] [0, 4] [0, 0] [0, 0]
[0, 0] [0, 0] [0, 0] [0, 0] [0, 4] [0, 0]
[0, 0] [0, 0] [0, 0] [0, 0] [0, 0] [0, 4]
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by running the Julia reproduction with ForwardDiff, StaticArrays, and IntervalArithmetic, and measure compilation time and allocations. Trace the jacobian call and its compilation path to identify the source of the excessive work; done means substantially lower compilation cost while preserving the shown 6×6 interval result.
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
- 35/100