perf(Algebra/Category/ModuleCat/Presheaf): speed up the monoidal pushforward instance#41753
Open
kbuzzard wants to merge 1 commit into
Open
perf(Algebra/Category/ModuleCat/Presheaf): speed up the monoidal pushforward instance#41753kbuzzard wants to merge 1 commit into
kbuzzard wants to merge 1 commit into
Conversation
…forward instance The `Functor.Monoidal` instance for `pushforward₀OfCommRingCat` used `Iso.refl _` for `μIso`. Although that is correct, it forces the unitality and associativity fields to be proved by tactics that leave a very large definitional unfolding for the kernel to redo, without the elaborator's caching and lazy unfolding. Introducing `pushforward₀OfCommRingCatμIso`, which is the same isomorphism but built section-wise with `isoMk`, lets the coherence fields be discharged by `tensor_ext`/`tensor_ext₃'` plus `rfl` on sections. The statement of the instance is unchanged; only the proof term is. Measured on the file in isolation: * kernel type checking: 2.27s -> 186ms * elaboration: 252ms -> 128ms * whole file (`lake env lean`, incl. ~1.2s of imports): 8.52s -> 3.41s Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
PR summary 7293186805Import changes for modified filesNo significant changes to the import graph Import changes for all files
|
| Current number | Change | Type (strong) |
|---|---|---|
| 5616 | -1 | backward.isDefEq.respectTransparency |
Current commit 7293186805
Reference commit b86f7b9ebe
This script lives in the mathlib-ci repository. To run it locally, from your mathlib4 directory:
git clone https://github.com/leanprover-community/mathlib-ci.git ../mathlib-ci
../mathlib-ci/scripts/reporting/technical-debt-metrics.sh pr_summary
- The
relativevalue is the weighted sum of the differences with weight given by the inverse of the current value of the statistic. - The
absolutevalue is therelativevalue divided by the total sum of the inverses of the current values (i.e. the weighted average of the differences).
Member
Author
|
!radar |
|
Benchmark results for 7293186 against b86f7b9 are in. There are significant results. @kbuzzard
Large changes (1✅)
|
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 was one of the slowest declarations to typecheck in mathlib. Replacing an
Iso.reflwith something more explicit yields something which the kernel finds far easier to swallow. As a bonus we can remove aset_option backward.isDefEq.respectTransparency false.