-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
1.9-rc1 regression - StaticArray
allocates Core.SimpleVector
objects, runtime dispatch
#49145
Comments
Probably gonna need some code as well. |
Found a minimal example. It appears to be when the length of an array is passed into a type parameter.
|
Looks like #45062 ? |
Linking my comment here: #48612 (comment) TL;DR: If a performance regression is determined to be unavoidable for a particular release, can it be well-documented, users warned if affected pattern found, and/or could a workaround be provided; or is some hacky patch possible to improve specific situations? An aim being to reduce surprise and effort in troubleshooting if and when users hit it, and enable decision making when it comes to upgrading from 1.8 to 1.9. |
An easy fix on @propagate_inbounds (::Type{SA})(a::AbstractArray) where {SA <: StaticArray} = convert(SA, a) with @propagate_inbounds (T::Type{<:StaticArray})(a::AbstractArray) = convert(T, a) This make sure we can skip the unneeded runtime subtyping. |
The workaround here seems to be I guess the tradeoff here is whether to hit a dynamic dispatch when calling the uninferrable It seems the choice made here is not the best. |
Yeah, we may need a heuristics fix for #45062, since right now it is likely pretty far off in the cost model |
1.9-rc1:
Time:
Allocations:
1.8.5:
Time:
Allocations:
With StaticArrays v1.5.19 on each
The text was updated successfully, but these errors were encountered: