Skip to content

Exceedingly long compilation time of a function involving StaticArrays #24286

Closed
@giordano

Description

I have a function which takes way too much to be compiled on Julia master, 10x slower than on Julia 0.6. It involves StaticArrays.jl. Actually, this package seems to be quite broken right now on Julia master, just entering the line Svector makes Julia crash very badly.

That said, until a couple of days ago this function:

using StaticArrays

const A1 = SVector(collect(1.0:60.0))
const B1 = SVector(collect(1.0:60.0))
const C1 = SVector(collect(1.0:60.0))
const D1 = SVector(collect(1.0:60.0))
const A2 = SVector(collect(1.0:60.0))
const B2 = SVector(collect(1.0:60.0))
const C2 = SVector(collect(1.0:60.0))
const D2 = SVector(collect(1.0:60.0))

function test()
    arg1 = A1 * 1.0 + B1 * 2.0 + C1 * 3.0 + D1 * 4.0
    arg2 = A2 * 1.0 + B2 * 2.0 + C2 * 3.0 + D2 * 4.0
    e = sin.(arg1)
    f = cos.(arg1)
    g = sin.(arg2)
end

took about 9-10 seconds to be run the fist time on Julia master (so including compilation time), while it takes ~0.9 seconds to be run the first time on Julia 0.6. The code returned by @code_llvm on Julia master is loooong, more than 5k lines, it doesn't fit in my terminal screen. My full (non-minimal) function takes actually even longer to be compiled, about 35 seconds, In Julia 0.6 it takes 1.5 seconds, what seems to cause the huge slowdown should be those sin and cos calls.

I was trying to reduce further the example, but a few minutes ago I updated Julia and I don't have the time to go back to a working version.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions