Skip to content

[Merged by Bors] - perf: reduce instance priority of Complex.instSMulRealComplex#12070

Closed
MichaelStollBayreuth wants to merge 2 commits intomasterfrom
MS_redInstPrio_SMulRealComplex
Closed

[Merged by Bors] - perf: reduce instance priority of Complex.instSMulRealComplex#12070
MichaelStollBayreuth wants to merge 2 commits intomasterfrom
MS_redInstPrio_SMulRealComplex

Conversation

@MichaelStollBayreuth
Copy link
Copy Markdown
Contributor

@MichaelStollBayreuth MichaelStollBayreuth commented Apr 11, 2024

See here on Zulip.

We reduce the instance priority of Complex.instSMulRealComplex to 90. This leads to a very significant speed-up in two Modular Forms files (and still noticeable speed-ups in some other files).


Open in Gitpod

@MichaelStollBayreuth MichaelStollBayreuth added WIP Work in progress awaiting-CI This PR does not pass CI yet. This label is automatically removed once it does. t-algebra Algebra (groups, rings, fields, etc) labels Apr 11, 2024
@github-actions github-actions bot removed the awaiting-CI This PR does not pass CI yet. This label is automatically removed once it does. label Apr 11, 2024
@MichaelStollBayreuth
Copy link
Copy Markdown
Contributor Author

!bench

@leanprover-bot
Copy link
Copy Markdown
Collaborator

Here are the benchmark results for commit 9855297.
There were significant changes against commit 30582ae:

  Benchmark                                         Metric         Change
  =======================================================================
+ ~Mathlib.NumberTheory.ModularForms.Basic          instructions   -29.9%
+ ~Mathlib.NumberTheory.ModularForms.SlashActions   instructions   -16.4%

@MichaelStollBayreuth MichaelStollBayreuth added awaiting-review and removed WIP Work in progress labels Apr 11, 2024
@mattrobball
Copy link
Copy Markdown
Contributor

Can you add a reference in the file to issue #11692?

@MichaelStollBayreuth
Copy link
Copy Markdown
Contributor Author

Done (also added a comment). Can you check that it is what you suggest?

@mattrobball
Copy link
Copy Markdown
Contributor

LGTM. Please merge when the CI finishes. Thanks.

bors delegate+

@mathlib-bors
Copy link
Copy Markdown
Contributor

mathlib-bors bot commented Apr 11, 2024

✌️ MichaelStollBayreuth can now approve this pull request. To approve and merge a pull request, simply reply with bors r+. More detailed instructions are available here.

@mattrobball
Copy link
Copy Markdown
Contributor

bors merge

@github-actions github-actions bot added ready-to-merge This PR has been sent to bors. and removed awaiting-review labels Apr 12, 2024
mathlib-bors bot pushed a commit that referenced this pull request Apr 12, 2024
See [here](https://leanprover.zulipchat.com/#narrow/stream/287929-mathlib4/topic/simp.20prefers.20CharP.2Ecast_eq_zero.20over.20Nat.2Ecast_zero/near/432760180) on Zulip.

We reduce the instance priority of `Complex.instSMulRealComplex` to 90. This leads to a very significant speed-up in two Modular Forms files (and still noticeable speed-ups in some other files).
@mathlib-bors
Copy link
Copy Markdown
Contributor

mathlib-bors bot commented Apr 12, 2024

Pull request successfully merged into master.

Build succeeded:

@mathlib-bors mathlib-bors bot changed the title perf: reduce instance priority of Complex.instSMulRealComplex [Merged by Bors] - perf: reduce instance priority of Complex.instSMulRealComplex Apr 12, 2024
@mathlib-bors mathlib-bors bot closed this Apr 12, 2024
@mathlib-bors mathlib-bors bot deleted the MS_redInstPrio_SMulRealComplex branch April 12, 2024 01:33
mathlib-bors bot pushed a commit that referenced this pull request Apr 14, 2024
This scopes and moves to `Complex.SMul` the instance `instSMulRealComplex`.
Rationale: This instance is used in `Data.Complex.{Basic|Module}` to bootstrap `SMul` instances from the reals, but afterwards, instances `SMul R ℂ` should not need to rely on that (rather be obtained via `Algebra R ℂ`, for example). This speeds up the two mentioned files a bit (in fact, it reverts a slow-down caused by reducing the instance priority in #12070) and does not seem to have any adverse effects.

I think this is a cleaner solution compared to just reducing the instance priority.

See [here](https://leanprover.zulipchat.com/#narrow/stream/287929-mathlib4/topic/simp.20prefers.20CharP.2Ecast_eq_zero.20over.20Nat.2Ecast_zero/near/432855625) on Zulip.
xgenereux pushed a commit that referenced this pull request Apr 15, 2024
See [here](https://leanprover.zulipchat.com/#narrow/stream/287929-mathlib4/topic/simp.20prefers.20CharP.2Ecast_eq_zero.20over.20Nat.2Ecast_zero/near/432760180) on Zulip.

We reduce the instance priority of `Complex.instSMulRealComplex` to 90. This leads to a very significant speed-up in two Modular Forms files (and still noticeable speed-ups in some other files).
xgenereux pushed a commit that referenced this pull request Apr 15, 2024
This scopes and moves to `Complex.SMul` the instance `instSMulRealComplex`.
Rationale: This instance is used in `Data.Complex.{Basic|Module}` to bootstrap `SMul` instances from the reals, but afterwards, instances `SMul R ℂ` should not need to rely on that (rather be obtained via `Algebra R ℂ`, for example). This speeds up the two mentioned files a bit (in fact, it reverts a slow-down caused by reducing the instance priority in #12070) and does not seem to have any adverse effects.

I think this is a cleaner solution compared to just reducing the instance priority.

See [here](https://leanprover.zulipchat.com/#narrow/stream/287929-mathlib4/topic/simp.20prefers.20CharP.2Ecast_eq_zero.20over.20Nat.2Ecast_zero/near/432855625) on Zulip.
atarnoam pushed a commit that referenced this pull request Apr 16, 2024
See [here](https://leanprover.zulipchat.com/#narrow/stream/287929-mathlib4/topic/simp.20prefers.20CharP.2Ecast_eq_zero.20over.20Nat.2Ecast_zero/near/432760180) on Zulip.

We reduce the instance priority of `Complex.instSMulRealComplex` to 90. This leads to a very significant speed-up in two Modular Forms files (and still noticeable speed-ups in some other files).
atarnoam pushed a commit that referenced this pull request Apr 16, 2024
This scopes and moves to `Complex.SMul` the instance `instSMulRealComplex`.
Rationale: This instance is used in `Data.Complex.{Basic|Module}` to bootstrap `SMul` instances from the reals, but afterwards, instances `SMul R ℂ` should not need to rely on that (rather be obtained via `Algebra R ℂ`, for example). This speeds up the two mentioned files a bit (in fact, it reverts a slow-down caused by reducing the instance priority in #12070) and does not seem to have any adverse effects.

I think this is a cleaner solution compared to just reducing the instance priority.

See [here](https://leanprover.zulipchat.com/#narrow/stream/287929-mathlib4/topic/simp.20prefers.20CharP.2Ecast_eq_zero.20over.20Nat.2Ecast_zero/near/432855625) on Zulip.
uniwuni pushed a commit that referenced this pull request Apr 19, 2024
See [here](https://leanprover.zulipchat.com/#narrow/stream/287929-mathlib4/topic/simp.20prefers.20CharP.2Ecast_eq_zero.20over.20Nat.2Ecast_zero/near/432760180) on Zulip.

We reduce the instance priority of `Complex.instSMulRealComplex` to 90. This leads to a very significant speed-up in two Modular Forms files (and still noticeable speed-ups in some other files).
uniwuni pushed a commit that referenced this pull request Apr 19, 2024
This scopes and moves to `Complex.SMul` the instance `instSMulRealComplex`.
Rationale: This instance is used in `Data.Complex.{Basic|Module}` to bootstrap `SMul` instances from the reals, but afterwards, instances `SMul R ℂ` should not need to rely on that (rather be obtained via `Algebra R ℂ`, for example). This speeds up the two mentioned files a bit (in fact, it reverts a slow-down caused by reducing the instance priority in #12070) and does not seem to have any adverse effects.

I think this is a cleaner solution compared to just reducing the instance priority.

See [here](https://leanprover.zulipchat.com/#narrow/stream/287929-mathlib4/topic/simp.20prefers.20CharP.2Ecast_eq_zero.20over.20Nat.2Ecast_zero/near/432855625) on Zulip.
callesonne pushed a commit that referenced this pull request Apr 22, 2024
See [here](https://leanprover.zulipchat.com/#narrow/stream/287929-mathlib4/topic/simp.20prefers.20CharP.2Ecast_eq_zero.20over.20Nat.2Ecast_zero/near/432760180) on Zulip.

We reduce the instance priority of `Complex.instSMulRealComplex` to 90. This leads to a very significant speed-up in two Modular Forms files (and still noticeable speed-ups in some other files).
callesonne pushed a commit that referenced this pull request Apr 22, 2024
This scopes and moves to `Complex.SMul` the instance `instSMulRealComplex`.
Rationale: This instance is used in `Data.Complex.{Basic|Module}` to bootstrap `SMul` instances from the reals, but afterwards, instances `SMul R ℂ` should not need to rely on that (rather be obtained via `Algebra R ℂ`, for example). This speeds up the two mentioned files a bit (in fact, it reverts a slow-down caused by reducing the instance priority in #12070) and does not seem to have any adverse effects.

I think this is a cleaner solution compared to just reducing the instance priority.

See [here](https://leanprover.zulipchat.com/#narrow/stream/287929-mathlib4/topic/simp.20prefers.20CharP.2Ecast_eq_zero.20over.20Nat.2Ecast_zero/near/432855625) on Zulip.
Jun2M pushed a commit that referenced this pull request Apr 24, 2024
This scopes and moves to `Complex.SMul` the instance `instSMulRealComplex`.
Rationale: This instance is used in `Data.Complex.{Basic|Module}` to bootstrap `SMul` instances from the reals, but afterwards, instances `SMul R ℂ` should not need to rely on that (rather be obtained via `Algebra R ℂ`, for example). This speeds up the two mentioned files a bit (in fact, it reverts a slow-down caused by reducing the instance priority in #12070) and does not seem to have any adverse effects.

I think this is a cleaner solution compared to just reducing the instance priority.

See [here](https://leanprover.zulipchat.com/#narrow/stream/287929-mathlib4/topic/simp.20prefers.20CharP.2Ecast_eq_zero.20over.20Nat.2Ecast_zero/near/432855625) on Zulip.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready-to-merge This PR has been sent to bors. t-algebra Algebra (groups, rings, fields, etc)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants