summaryrefslogtreecommitdiff
path: root/test/files/pos/t8531/Test.scala
diff options
context:
space:
mode:
authorJason Zaugg <jzaugg@gmail.com>2014-04-24 10:53:20 +0200
committerJason Zaugg <jzaugg@gmail.com>2014-05-08 10:33:45 +0200
commitb154269b0e7447cfbf7fdb73c8c4efcdca545b11 (patch)
tree662076793ed1333d8d0393efac365f9fe3cd80b9 /test/files/pos/t8531/Test.scala
parentaa3a3dd6a420f57b0fe815bfcb2b23fbb4284468 (diff)
downloadscala-b154269b0e7447cfbf7fdb73c8c4efcdca545b11.tar.gz
scala-b154269b0e7447cfbf7fdb73c8c4efcdca545b11.tar.bz2
scala-b154269b0e7447cfbf7fdb73c8c4efcdca545b11.zip
SI-8531 Better space efficiency for patmat analysis
By adding logging to `clause`, I found that the majority of calls provide 0 or 1 elements. In SI-7020 / 69557da55, we changed this method to use a `LinkedHashSet` to have deterministic results for clauses with more elements. But I suspect that this contributes to higher memory usage from the pattern matcher. The enclosed test case, carefully whittled down by @oxbowlakes, used to consume an inordinate amount of memory and time. After this patch, it is back to 2.10.4 performance. I have run `neg/t7020.scala` in a loop and it still is deterministic.
Diffstat (limited to 'test/files/pos/t8531/Test.scala')
-rw-r--r--test/files/pos/t8531/Test.scala24
1 files changed, 24 insertions, 0 deletions
diff --git a/test/files/pos/t8531/Test.scala b/test/files/pos/t8531/Test.scala
new file mode 100644
index 0000000000..59861435a6
--- /dev/null
+++ b/test/files/pos/t8531/Test.scala
@@ -0,0 +1,24 @@
+package test
+
+// takes > 50s and > 800M heap to compile under 2.11.0
+import foobar._
+class `SI-8531` {
+ //https://issues.scala-lang.org/browse/SI-8531
+
+ import MyEnum._
+ def foo(e1: MyEnum, e2: MyEnum) = (e1, e2) match {
+ case (A1, x) => "a1"
+ case (x, A1) => "a1"
+ case (A2, x) => "a2"
+ case (x, A2) => "a2"
+ case (A3, x) => "a3"
+ case (x, A3) => "a3"
+ case (A4, x) => "a4"
+ case (x, A4) => "a4"
+ case (A5, x) => "a5"
+ case (x, A5) => "a5"
+ case (A6, x) => "a6"
+ case (x, A6) => "a6"
+ case (a, b) => "ab"
+ }
+}