Skip to content
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

Fix #12358: Avoid spurious unions in simplification #12367

Merged
merged 4 commits into from
May 11, 2021

Conversation

liufengyun
Copy link
Contributor

Fix #12358: Avoid spurious unions in simplification
And be more lazier in product subtraction

@liufengyun
Copy link
Contributor Author

liufengyun commented May 7, 2021

test performance with #exhaustivity please

@liufengyun liufengyun requested a review from bishabosha May 7, 2021 14:17
@dottybot
Copy link
Member

dottybot commented May 7, 2021

Performance test finished successfully:

Visit https://dotty-bench.epfl.ch/12367/ to see the changes.

Benchmarks is based on merging with master (f84322e)

@scala scala deleted a comment from dottybot May 7, 2021
@scala scala deleted a comment from dottybot May 7, 2021
@scala scala deleted a comment from dottybot May 7, 2021
@bishabosha
Copy link
Member

if I test with 120 cases in the repl it seems to be much slower with this change

def foo(x: List[Int]): Unit = x match { case x1 :: x2 :: x3 :: x4 :: x5 :: x6 :: x7 :: x8 :: x9 :: x10 :: x11 :: x12 :: x13 :: x14 :: x15 :: x16 :: x17 :: x18 :: x19 :: x20 :: x21 :: x22 :: x23 :: x24 :: x25 :: x26 :: x27 :: x28 :: x29 :: x30 :: x31 :: x32 :: x33 :: x34 :: x35 :: x36 :: x37 :: x38 :: x39 :: x40 :: x41 :: x42 :: x43 :: x44 :: x45 :: x46 :: x47 :: x48 :: x49 :: x50 :: x51 :: x52 :: x53 :: x54 :: x55 :: x56 :: x57 :: x58 :: x59 :: x60 :: x61 :: x62 :: x63 :: x64 :: x65 :: x66 :: x67 :: x68 :: x69 :: x70 :: x71 :: x72 :: x73 :: x74 :: x75 :: x76 :: x77 :: x78 :: x79 :: x80 :: x81 :: x82 :: x83 :: x84 :: x85 :: x86 :: x87 :: x88 :: x89 :: x90 :: x91 :: x92 :: x93 :: x94 :: x95 :: x96 :: x97 :: x98 :: x99 :: x100 :: x101 :: x102 :: x103 :: x104 :: x105 :: x106 :: x107 :: x108 :: x109 :: x110 :: x111 :: x112 :: x113 :: x114 :: x115 :: x116 :: x117 :: x118 :: x119 :: x120 :: Nil => }

@bishabosha bishabosha assigned liufengyun and unassigned bishabosha May 10, 2021
@liufengyun
Copy link
Contributor Author

if I test with 120 cases in the repl it seems to be much slower with this change

def foo(x: List[Int]): Unit = x match { case x1 :: x2 :: x3 :: x4 :: x5 :: x6 :: x7 :: x8 :: x9 :: x10 :: x11 :: x12 :: x13 :: x14 :: x15 :: x16 :: x17 :: x18 :: x19 :: x20 :: x21 :: x22 :: x23 :: x24 :: x25 :: x26 :: x27 :: x28 :: x29 :: x30 :: x31 :: x32 :: x33 :: x34 :: x35 :: x36 :: x37 :: x38 :: x39 :: x40 :: x41 :: x42 :: x43 :: x44 :: x45 :: x46 :: x47 :: x48 :: x49 :: x50 :: x51 :: x52 :: x53 :: x54 :: x55 :: x56 :: x57 :: x58 :: x59 :: x60 :: x61 :: x62 :: x63 :: x64 :: x65 :: x66 :: x67 :: x68 :: x69 :: x70 :: x71 :: x72 :: x73 :: x74 :: x75 :: x76 :: x77 :: x78 :: x79 :: x80 :: x81 :: x82 :: x83 :: x84 :: x85 :: x86 :: x87 :: x88 :: x89 :: x90 :: x91 :: x92 :: x93 :: x94 :: x95 :: x96 :: x97 :: x98 :: x99 :: x100 :: x101 :: x102 :: x103 :: x104 :: x105 :: x106 :: x107 :: x108 :: x109 :: x110 :: x111 :: x112 :: x113 :: x114 :: x115 :: x116 :: x117 :: x118 :: x119 :: x120 :: Nil => }

Thanks for trying. I'd suggest to handle it separately, as this PR is a blocker for #12357 .

@liufengyun
Copy link
Contributor Author

if I test with 120 cases in the repl it seems to be much slower with this change

def foo(x: List[Int]): Unit = x match { case x1 :: x2 :: x3 :: x4 :: x5 :: x6 :: x7 :: x8 :: x9 :: x10 :: x11 :: x12 :: x13 :: x14 :: x15 :: x16 :: x17 :: x18 :: x19 :: x20 :: x21 :: x22 :: x23 :: x24 :: x25 :: x26 :: x27 :: x28 :: x29 :: x30 :: x31 :: x32 :: x33 :: x34 :: x35 :: x36 :: x37 :: x38 :: x39 :: x40 :: x41 :: x42 :: x43 :: x44 :: x45 :: x46 :: x47 :: x48 :: x49 :: x50 :: x51 :: x52 :: x53 :: x54 :: x55 :: x56 :: x57 :: x58 :: x59 :: x60 :: x61 :: x62 :: x63 :: x64 :: x65 :: x66 :: x67 :: x68 :: x69 :: x70 :: x71 :: x72 :: x73 :: x74 :: x75 :: x76 :: x77 :: x78 :: x79 :: x80 :: x81 :: x82 :: x83 :: x84 :: x85 :: x86 :: x87 :: x88 :: x89 :: x90 :: x91 :: x92 :: x93 :: x94 :: x95 :: x96 :: x97 :: x98 :: x99 :: x100 :: x101 :: x102 :: x103 :: x104 :: x105 :: x106 :: x107 :: x108 :: x109 :: x110 :: x111 :: x112 :: x113 :: x114 :: x115 :: x116 :: x117 :: x118 :: x119 :: x120 :: Nil => }

I just tried, both this PR and Scala 3.0.0-RC2 run in about ~10s. What's the case in your run @bishabosha ?

@liufengyun liufengyun requested a review from griggt May 10, 2021 15:34
Copy link
Contributor

@griggt griggt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can confirm that this fixes #12358 and unblocks #12357.

Regarding the 120 case test mentioned above, I'm seeing cold performance of ~10s with this PR vs. ~6s with 3.0.0-RC3.

@liufengyun
Copy link
Contributor Author

Regarding the 120 case test mentioned above, I'm seeing cold performance of ~10s with this PR vs. ~6s with 3.0.0-RC3.

Thanks @griggt . I think we may have to tolerate the case. From https://dotty-bench.epfl.ch/12367/, the test exhaustivity T also becomes slower.

@liufengyun
Copy link
Contributor Author

Merge now to unblock #12357.

@liufengyun liufengyun merged commit 4410752 into scala:master May 11, 2021
@liufengyun liufengyun deleted the fix-12358 branch May 11, 2021 14:49
@Kordyjan Kordyjan added this to the 3.0.1 milestone Aug 2, 2023
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.

Can't build upstream cats with recent nightlies
5 participants