Repository navigation
Cache hot helpers recomputed during semantic analysis - #1617
Merged
Merged
Conversation
`Body::containing_func` walked every item in the module's scope graph to find the function owning the body. A function body is lowered inside the function's item scope, so the function is the body's lexical parent. The walk took ~7% of `fe test` time over the fe_test fixtures, mostly via `TypedBody::return_provenance`. A temporary assertion comparing both lookups held across the full test suite.
`PredicateListId::extend_all_bounds` recomputed the transitive super-trait and associated-type bounds on every trait selection and satisfiability check, ~12% of `fe test` time over the fe_test fixtures. Make it a salsa query keyed on the interned list. Normalizing implied bounds can lead back to the same list (e.g. trait projections and associated-type cycles in the ty_check/uitest fixtures), so the query iterates to a fixpoint from the unextended list.
`resolve_effect_handle` ran trait impl selection for `EffectHandle` every time the borrow checker or layout lowering asked whether a type is an effect handle, ~15% of `fe test` time over the fe_test fixtures. Keep the cheap rejections inline and cache the rest as a salsa query.
`Func::arg_tys` recomputed the full implicit parameter plan on every call to find the bindings from input layout holes to implicit const params, ~9% of `fe test` time over the fe_test fixtures. Cache the bindings per function. Generic parameter collection still builds the plan directly, so the new query stays outside its cycle recovery.
`TyId::field_types` re-instantiated ADT field shapes on every call; the borrow checker's shape building and `is_zero_sized` ask for the same aggregates repeatedly. Cache the result per type (~5% of `fe test` time over a heavy fe_test fixture subset).
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
This was referenced Sep 28, 2026
cburgdorf
added a commit
that referenced
this pull request
Sep 30, 2026
Several user-facing changes merged after 26.3 were missing release notes entries: - Bugfixes: event ABI `anonymous` flag (#1562), string literal escapes (#1563), effect provider identity (#1564), shared calls on non-Copy fields (#1581), recursive raw pointer types (#1609). - Performance: `DynArray::get` for static elements (#1559), constant string ABI encoding (#1560), compile-time caching (#1617, #1619, #1621). - Native backend features: workspaces, native tests and `std::io` (#1565), process arguments and CPU timing (#1566), `ByteBuffer` (#1580).
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.
Profiling
fe testover the fe_test fixtures showed most compile time in the semantic borrow checker and related queries, with large shares spent in helper functions that were recomputed on every call from inside those queries. This caches or shortcuts the biggest ones:Body::containing_funcfinds the function from the body's parent scope instead of walking every item in the module (~7% offe testtime).PredicateListId::extend_all_boundsis a salsa query keyed on the interned list (~12%). Normalizing implied bounds can lead back to the same list (trait projections, associated-type cycles), so it iterates to a fixpoint from the unextended list.resolve_effect_handleis cached behind its cheap early-outs (~15%).Func::arg_tys(~9%). Generic parameter collection still builds the implicit parameter plan directly, so the new query stays outside that cycle.TyId::field_typesis cached per type (~5% on a heavy fixture subset).Local measurements (M-series, release):
fe test --jobs 1over all fe_test fixtures: 254s -> ~140s.cli_output-30%, semantic borrowck tests -22%.A temporary assertion comparing the new
containing_funclookup with the old module walk held across the full test suite. The full suite passes; snapshots are unchanged.