-
-
Notifications
You must be signed in to change notification settings - Fork 270
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
improve inferrability of prune_graph!
#3202
improve inferrability of prune_graph!
#3202
Conversation
This fixes some invalidations when loading HDF5.jl
new_vdict = Vector{Dict{VersionNumber, Int}}(undef, length(new_pvers)) | ||
for new_p0 in eachindex(new_vdict) | ||
new_vdict[new_p0] = Dict(vn => v0 for (v0,vn) in enumerate(new_pvers[new_p0])) | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wouldn't
new_vdict = Dict{VersionNumber, Int}[Dict(vn => v0 for (v0,vn) in enumerate(new_pvers[new_p0])) for new_p0 = 1:new_np]
also work?
src/Resolve/graphtype.jl
Outdated
new_vdict[new_p0] = Dict(vn => v0 for (v0,vn) in enumerate(new_pvers[new_p0])) | ||
end | ||
# The code above is essentially equivalent to | ||
# new_vdict = [Dict(vn => v0 for (v0,vn) in enumerate(new_pvers[new_p0])) for new_p0 = 1:new_np] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this whole chunk can used be written as
# explicitly writing out the loop since the generator equivalent caused type inference failure
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will be AFK in the next few days. Could you please make the changes you suggested? Otherwise, I will revisit this some time in October.
* improve inferrability of `prune_graph!` This fixes some invalidations when loading HDF5.jl * update comment Co-authored-by: Kristoffer Carlsson <[email protected]> (cherry picked from commit 0d5230b)
* improve inferrability of `prune_graph!` This fixes some invalidations when loading HDF5.jl * update comment Co-authored-by: Kristoffer Carlsson <[email protected]> (cherry picked from commit 0d5230b)
* improve inferrability of `prune_graph!` This fixes some invalidations when loading HDF5.jl * update comment Co-authored-by: Kristoffer Carlsson <[email protected]>
I improved type stability to fix some invalidations. This is based on the following code:
I suggest the labels
latency
andbackport-1.8
. With a recent build of Pkg based on therelease-1.8
branch and this commit, I get