Skip to content

[Merged by Bors] - perf(VectorBundle/FiberwiseLinear): speed up#13454

Closed
grunweg wants to merge 6 commits intomasterfrom
MR-profile-fiberwise-linear
Closed

[Merged by Bors] - perf(VectorBundle/FiberwiseLinear): speed up#13454
grunweg wants to merge 6 commits intomasterfrom
MR-profile-fiberwise-linear

Conversation

@grunweg
Copy link
Copy Markdown
Contributor

@grunweg grunweg commented Jun 2, 2024

#12061 regressed this file pretty badly; speed it up again by mostly reverting a change from that PR, and pushing it further: instead of applying mem_iUnion (which is slow), extract a more specialised statement mem_aux and use it.

Before these changes, the profiler output on smoothFiberwiseLinear was

simp took 2.01s
tactic execution of Lean.Parser.Tactic.rintro took 103ms
simp took 905ms
simp took 507ms
simp took 1.26s
simp took 1.14s
elaboration took 645ms

after these changes, it is

simp took 534ms
simp took 183ms
simp took 127ms
simp took 421ms
simp took 365ms
elaboration took 350ms

Still not great at all, but deeper fixes require more time and expertise than I currently have.


I cannot recover the link to the post-merge perf. run from speed.lean-lang.org; help with that welcome.

Open in Gitpod

#12061 regressed this file pretty badly; try to speed it up again
@grunweg
Copy link
Copy Markdown
Contributor Author

grunweg commented Jun 2, 2024

!bench

@leanprover-bot
Copy link
Copy Markdown
Collaborator

Here are the benchmark results for commit 99a4f06.
There were significant changes against commit 6f758e5:

  Benchmark                                                 Metric         Change
  ===============================================================================
+ ~Mathlib.Geometry.Manifold.VectorBundle.FiberwiseLinear   instructions   -38.7%

@grunweg grunweg changed the title perf(VectorBundle/FiberwiseLinear): try to speed up again perf(VectorBundle/FiberwiseLinear): speed up Jun 2, 2024
@ghost ghost added the merge-conflict The PR has a merge conflict with master, and needs manual merging. (this label is managed by a bot) label Jun 3, 2024
@ghost ghost removed the merge-conflict The PR has a merge conflict with master, and needs manual merging. (this label is managed by a bot) label Jun 3, 2024
@grunweg grunweg force-pushed the MR-profile-fiberwise-linear branch from 3ec0233 to a27a9cb Compare June 3, 2024 09:11
@urkud
Copy link
Copy Markdown
Member

urkud commented Jun 8, 2024

Do you know why simp only [mem_iUnion] is so slow?

@grunweg
Copy link
Copy Markdown
Contributor Author

grunweg commented Jun 8, 2024

I do not. Understanding and fixing this would be nice. Would you like me to add a TODO?

@urkud
Copy link
Copy Markdown
Member

urkud commented Jun 9, 2024

Yes, please. Otherwise LGTM. Thanks!
bors d+

@mathlib-bors
Copy link
Copy Markdown
Contributor

mathlib-bors bot commented Jun 9, 2024

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

@github-actions github-actions bot added delegated This pull request has been delegated to the PR author (or occasionally another non-maintainer). and removed awaiting-review labels Jun 9, 2024
@grunweg
Copy link
Copy Markdown
Contributor Author

grunweg commented Jun 10, 2024

Thanks for the review!
bors r+

@github-actions
Copy link
Copy Markdown

PR summary

Import changes

No significant changes to the import graph


Declarations diff

No declarations were harmed in the making of this PR! 🐙

You can run this locally as follows
## summary with just the declaration names:
./scripts/no_lost_declarations.sh short <optional_commit>

## more verbose report:
./scripts/no_lost_declarations.sh <optional_commit>

mathlib-bors bot pushed a commit that referenced this pull request Jun 10, 2024
#12061 regressed this file pretty badly; speed it up again by mostly reverting a change from that PR, and pushing it further: instead of applying `mem_iUnion` (which is slow), extract a more specialised statement `mem_aux` and use it.

Before these changes, the `profiler` output on `smoothFiberwiseLinear` was
```
simp took 2.01s
tactic execution of Lean.Parser.Tactic.rintro took 103ms
simp took 905ms
simp took 507ms
simp took 1.26s
simp took 1.14s
elaboration took 645ms
```
after these changes, it is
```
simp took 534ms
simp took 183ms
simp took 127ms
simp took 421ms
simp took 365ms
elaboration took 350ms
```
Still not great at all, but deeper fixes require more time and expertise than I currently have.
@mathlib-bors
Copy link
Copy Markdown
Contributor

mathlib-bors bot commented Jun 10, 2024

Pull request successfully merged into master.

Build succeeded:

@mathlib-bors mathlib-bors bot changed the title perf(VectorBundle/FiberwiseLinear): speed up [Merged by Bors] - perf(VectorBundle/FiberwiseLinear): speed up Jun 10, 2024
@mathlib-bors mathlib-bors bot closed this Jun 10, 2024
@mathlib-bors mathlib-bors bot deleted the MR-profile-fiberwise-linear branch June 10, 2024 06:15
AntoineChambert-Loir pushed a commit that referenced this pull request Jun 20, 2024
#12061 regressed this file pretty badly; speed it up again by mostly reverting a change from that PR, and pushing it further: instead of applying `mem_iUnion` (which is slow), extract a more specialised statement `mem_aux` and use it.

Before these changes, the `profiler` output on `smoothFiberwiseLinear` was
```
simp took 2.01s
tactic execution of Lean.Parser.Tactic.rintro took 103ms
simp took 905ms
simp took 507ms
simp took 1.26s
simp took 1.14s
elaboration took 645ms
```
after these changes, it is
```
simp took 534ms
simp took 183ms
simp took 127ms
simp took 421ms
simp took 365ms
elaboration took 350ms
```
Still not great at all, but deeper fixes require more time and expertise than I currently have.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

delegated This pull request has been delegated to the PR author (or occasionally another non-maintainer). t-differential-geometry Manifolds etc

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants