-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
SI-12499 performance regression in patmat. #10168
Conversation
Introduced in 6eaf217. ListSets are slow.
I don't think this is enough because I don't know the code well enough to know why, and we don't have a performant ordered set in the collections library, so I'm not sure what to do. |
/rebuild |
It doesn't say it's important, it says it's "to stabilise the results" which is unlikely to mean anything beyond how the error is printed. The test which failed in CI doesn't fail that way for me, so I'm assuming for now it's spurious. |
Failure isn't spurious but doesn't make sense to me. I guess the orderedness of the set is being relied upon for correctness. Still weird that it doesn't fail on my machine. |
The error as it is lists a lot of unnecessary cases: List(5) match {
case 1 :: Nil | 2 :: Nil =>
case (x@(4 | 5 | 6)) :: Nil =>
case 7 :: Nil =>
case Nil =>
}
The last case |
The comments make it seem like it was actually going for that output? I think it's that pathology where people start writing code to protect whatever the test case says the output should be. I changed it not to include patterns which cover other patterns and it went straight to the correct output.
|
I don't know how much I trust its ideas about exhaustiveness. object Test {
def f(xs: List[Int]) = xs match {
case List(_) =>
}
}
|
I think you guys are out of luck. Have to touch too many places to rescue the performance while preserving existing behaviors. |
Note that the Scala 2.13 collections introduced Another contributor might be interested in trying to find a way forward with whatever is available. |
Introduced in 6eaf217. ListSets are slow.
Fixes scala/bug#12499