scala/scala — pull request #3727 by retronym (2014-05-08 08:35:06+00:00)
Title: 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.

Review by @adriaanm

Resubmission of #3696 that included a test and uses `toSet` as
suggested.