Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RFC: in TC resolution, ← instantiateMVars (← inferType mvar) is computed 2 or 3 times over for every new goal #4284

Closed
JovanGerb opened this issue May 26, 2024 · 3 comments
Labels
closing soon This issue will be closed soon (<1 month) as it is missing essential features. RFC Request for comments

Comments

@JovanGerb
Copy link
Contributor

JovanGerb commented May 26, 2024

Proposal

These three lines do this same computation:

let mvarType ← instantiateMVars mvarType

let mvarType ← instantiateMVars mvarType

let mvarType ← instantiateMVars (← inferType mvar)

I propose to do it once, and pass this result as an argument to all these functions.

@kim-em
Copy link
Collaborator

kim-em commented Jun 5, 2024

Is there evidence that this change by itself would have a performance impact?

@JovanGerb
Copy link
Contributor Author

I hadn't tested it separately yet, but here's a PR for it now: #4379
Fixing only this also involved moving the withMCtx around a bit, because the instantiateMVars needs to be in the relevant metavariable context. I have an issue for this here #4286

@JovanGerb
Copy link
Contributor Author

The result of the test on Mathlib is that this change is responsible for all of the performance improvement in #4277.

@leodemoura leodemoura added the closing soon This issue will be closed soon (<1 month) as it is missing essential features. label Jun 19, 2024
@Kha Kha closed this as not planned Won't fix, can't repro, duplicate, stale Aug 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
closing soon This issue will be closed soon (<1 month) as it is missing essential features. RFC Request for comments
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants