Fix some invalidations during Julia's bootstrap #36427
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This cuts the total number of invalidations that occur during Julia's build process approximately in half. It may knock about 2% off Julia's build time, though that's about in the noise so I am not sure. Here was one run on
master
:and here were two runs on this(*caveat: also using #35877) branch:
Interestingly, both were about a second longer on generating the precompile statements, reducing or eliminating the total advantage. I don't know whether that's systematic. (With fewer to build, you might expect it to be faster, maybe?)
The remaining invalidations fit a couple of patterns:
reducedim.jl
, which specialize methods already in active use fromreduce.jl
promote_rule
invalidations due to specializing the fallbacks. None of these have large cascades of consequences, however.MethodInstances
(~80? I don't really remember), from code that might call a function before it has any methods defined (result: they mt-invalidate themselves):with_output_color
gets used by theshow
method incmd.jl
which gets used by Base.FileRedirect via the logging frameworkfill!
isn't defined until well after its first potential use byshow(io::IO, x::Type)
, via thevcat
callWhile trying to understand the
with_output_color
phenomenon I added a@nospecialize
, this is a bonus but it seems reasonable.I'm happy to back out some of these if folks prefer, just let me know. I was basically going down the list, but none of these are game-changing so we can afford to drop some.