Skip to content

Fix #8922: Performance tweak for space computation #8928

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

Merged
merged 9 commits into from
May 11, 2020

Conversation

liufengyun
Copy link
Contributor

We first subtract the last pattern, usually, it's a wildcard, thus speeds up computation.

In computing Prod(K, a1, a2, ..) - Prod(K, b1, b2, ..), if there exists one dimension that is
not reducible, i.e. a_i < a_i - b_i, then the result is just Prod(K, a1, a2, ..).

Fixes #8922, #7186

liufengyun added 7 commits May 9, 2020 20:47
We first substract the last pattern, usually it's a wildcard, thus speeds up computation.

In computing `Prod(K, a1, a2, ..) - Prod(K, b1, b2, ..)`, if there exists one dimension that is
not reducible, i.e. `a_i < a_i - b_i`, then the result is just `Prod(K, a1, a2, ..)`.
Useful for the following test:

tests/run-custom-args/tuple-cons.scala
@liufengyun
Copy link
Contributor Author

test performance please

@dottybot
Copy link
Member

performance test scheduled: 1 job(s) in queue, 0 running.

@dottybot
Copy link
Member

Performance test finished successfully:

Visit http://dotty-bench.epfl.ch/8928/ to see the changes.

Benchmarks is based on merging with master (5154641)

@nicolasstucki
Copy link
Contributor

exhaustivity S benchmark had a slowdown.

@liufengyun
Copy link
Contributor Author

The S test and T test they have different ordering: the T has more general patterns at the end, while S has the general patterns at the beginning.

In this PR, we process the patterns backwards, thus T becomes faster, and S slower. In practice, patterns are more like T, thus it seems to me a good and simple heuristics.

@nicolasstucki nicolasstucki merged commit dd98d4a into scala:master May 11, 2020
@nicolasstucki nicolasstucki deleted the fix-8922 branch May 11, 2020 12:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Compiler hangs in a match block
3 participants