Closed JovanGerb closed 1 month ago
Is there evidence that this change by itself would have a performance impact?
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
The result of the test on Mathlib is that this change is responsible for all of the performance improvement in #4277.
Proposal
These three lines do this same computation:
https://github.com/leanprover/lean4/blob/f05a82799a01569edeb5e2594cd7d56282320f9e/src/Lean/Meta/SynthInstance.lean#L286 https://github.com/leanprover/lean4/blob/f05a82799a01569edeb5e2594cd7d56282320f9e/src/Lean/Meta/SynthInstance.lean#L243 https://github.com/leanprover/lean4/blob/f05a82799a01569edeb5e2594cd7d56282320f9e/src/Lean/Meta/SynthInstance.lean#L474
I propose to do it once, and pass this result as an argument to all these functions.