Skip to content

Return type op fast path results without the full fulfillment machinery [-0.83% avg] - #30

Draft
xmakro wants to merge 1 commit into
perf/base-0703from
perf/typeop-fastpath-hoist
Draft

Return type op fast path results without the full fulfillment machinery [-0.83% avg]#30
xmakro wants to merge 1 commit into
perf/base-0703from
perf/typeop-fastpath-hoist

Conversation

@xmakro

@xmakro xmakro commented Jul 4, 2026

Copy link
Copy Markdown
Owner

Query type ops check their fast paths (trivial sizedness proofs, alias free normalizations) inside the closure passed to scrape_region_constraints, so every fast path hit still paid for an inference snapshot, an ObligationCtxt with a boxed fulfillment engine, and the region constraint scraping itself, all over empty data. MIR type check issues several type ops per statement and the overwhelming majority hit a fast path.

Fast path results are final: they register no obligations and produce no region constraints, so the fast path is now checked once at the top of fully_perform and the result returned directly. resolve_vars_if_possible is kept on the returned value, matching what scrape_region_constraints did before.

Skipping the scrape requires that no region state is pending on the inference context between type ops. The one place that violated this, the eager hidden type equation reached from relate_opaques, now rolls back on failure via commit_if_ok, and the fast path asserts the invariant through a new InferCtxt::has_pending_region_state helper.

@xmakro
xmakro force-pushed the perf/typeop-fastpath-hoist branch from 5190b9a to 03969d2 Compare July 26, 2026 05:57
@xmakro xmakro changed the title Return type op fast path results without the full fulfillment machinery Return type op fast path results without the full fulfillment machinery [-0.83% avg] Jul 26, 2026
@xmakro
xmakro force-pushed the perf/typeop-fastpath-hoist branch 2 times, most recently from 26da146 to 04c5b11 Compare August 10, 2026 03:19
@xmakro
xmakro force-pushed the perf/typeop-fastpath-hoist branch from 04c5b11 to 29e4967 Compare August 10, 2026 03:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant