-
-
Notifications
You must be signed in to change notification settings - Fork 5.7k
Open
Labels
performanceMust go fasterMust go fasterregressionRegression in behavior compared to a previous versionRegression in behavior compared to a previous version
Description
With the current commit on the backports-release-1.9 branch (29889c7), in StaticArrays.jl a type instability is triggered when running Julia with --check-bounds=no. I tried to create an MWE as follows:
Start Julia with
JULIA_DEPOT_PATH=$PWD/tmp-depot path/to/julia-1.9-29889c7a1c --project=. --check-bounds=nofor a clean depot. Then run the following code:
julia> using Pkg; Pkg.add(PackageSpec(name="StaticArrays", version=v"1.5.21"))
julia> using StaticArrays
julia> some_vec = SVector(1.0)
1-element SVector{1, Float64} with indices SOneTo(1):
1.0
julia> foo(u) = SVector(u[1])
foo (generic function with 1 method)
julia> @code_warntype foo(some_vec)
MethodInstance for foo(::SVector{1, Float64})
from foo(u) @ Main REPL[4]:1
Arguments
#self#::Core.Const(foo)
u::SVector{1, Float64}
Body::Any
1 ─ %1 = Base.getindex(u, 1)::Float64
│ %2 = Main.SVector(%1)::Any
└── return %2When starting Julia without --check-bounds=no, the output of @code_warntype is as expected:
julia> @code_warntype foo(some_vec)
MethodInstance for foo(::SVector{1, Float64})
from foo(u) @ Main REPL[4]:1
Arguments
#self#::Core.Const(foo)
u::SVector{1, Float64}
Body::SVector{1, Float64}
1 ─ %1 = Base.getindex(u, 1)::Float64
│ %2 = Main.SVector(%1)::SVector{1, Float64}
└── return %2This causes a considerable performance regression to the point that code that heavily uses StaticArrays in hot loops becomes unusable.
cc @ranocha
Metadata
Metadata
Assignees
Labels
performanceMust go fasterMust go fasterregressionRegression in behavior compared to a previous versionRegression in behavior compared to a previous version