Split shallow_resolve into an inlinable fast path [-0.10% avg] - #103
Draft
xmakro wants to merge 1 commit into
Draft
Split shallow_resolve into an inlinable fast path [-0.10% avg]#103xmakro wants to merge 1 commit into
xmakro wants to merge 1 commit into
Conversation
The overwhelmingly common case is a type that is not an inference variable, which can be answered by looking at the kind. Keep that path tiny and inlinable at the many cross-crate call sites and push variable resolution into a separate never-inlined function.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
The overwhelmingly common case is a type that is not an inference variable, which can be answered by looking at the type kind. Keep that path tiny and inlinable at the many cross-crate call sites and push the actual variable resolution into a separate never-inlined function.
Measured alone at head 969b803 (clean from-scratch ThinLTO plus jemalloc stage2 build per side, instructions:u, Check/Debug/Opt across Full/IncrFull/IncrUnchanged/IncrPatched, 551 cells): -0.10% mean, 70 cells improved by at least 0.25%, 1 regressed. Top cells: projection-caching check full -1.13%, deeply-nested-multi check full -0.90%, unify-linearly check full -0.81%.
Caveat: this is an inlining change rather than work removal, and the local proxy has no PGO or BOLT, so the collector may credit inlining that a dist build would already have done. Expect the upstream number to come in under the local one.