perf: handle match_same_ctor.het similar to matchers in compiler#12850
Merged
perf: handle match_same_ctor.het similar to matchers in compiler#12850
Conversation
Contributor
Author
|
!bench |
|
Benchmark results for 1140ac1 against e2b500b are in! @hargoniX
Small changes (92🟥) Too many entries to display here. View the full report on radar instead. |
Contributor
Author
|
!bench |
|
Benchmark results for a513f68 against e2b500b are in. There are no significant changes. @Garmelon @hargoniX
Small changes (2✅, 2🟥)
|
|
Mathlib CI status (docs):
|
Collaborator
|
Reference manual CI status:
|
Contributor
Author
|
!bench |
|
Benchmark results for a513f68 against e2b500b are in. There are no significant changes. @hargoniX
Small changes (2✅, 2🟥)
|
Contributor
Author
|
!bench |
|
Benchmark results for 1bca92e against e2b500b are in. Significant changes detected! @hargoniX
Large changes (1✅)
Medium changes (2✅)
Small changes (346✅, 2🟥) Too many entries to display here. View the full report on radar instead. |
nomeata
approved these changes
Mar 9, 2026
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.
This PR optimizes the handling of
match_same_ctor.hetto make it emit nice match trees as opposed to unoptimized CPS style code.match_same_ctor.hetis essentially a specialized kind of matcher where we know that two objects are built from the same constructor and we wish to call a continuation on their data. This means for every constructor that contains datahettakes one closure as an argument. Then after matching on one of the objects every closure but the one relevant for the match is released in every match arm, causing quadratic code generation. This PR ensures that thehetdeclarations get inlined and then further processed by ordinary matcher and casesOn compilation, thereby removing all of the continuations from the compiled code.