Closed KisaragiEffective closed 1 year ago
seems plausible. @scala/collections crew might have further insight
Overriding scala.collection.mutable.LinkedHashSet#addAll should cause binary compatibility issue. See the link below: https://github.com/scala/scala/pull/10235#issuecomment-1336781619
One of the binary compatibility issue is from LinkedHashMap#addAll. I think LinkedHashSet#addAll should have same issue.
@KisaragiEffective have you tested on the current 2.13.11 nightly?
@SethTisue No, not yet. I don't know how to test this with latest nightly.
@KisaragiEffective scala-cli -S 2.nightly
; see also https://stackoverflow.com/a/40622879/86485 for other methods and more detail
@SethTisue I've tested with 2.13.11-bin-8269bdd
, and 5 of 5 attempts indicate LinkedHashSet is slower 2~4 times than HashSet.
I didn't realize this was related to https://github.com/scala/scala/pull/10258, I'll take a look if we can include it in 2.13.11
Reproduction steps
Scala version: 2.13.10 (scastie)
Problem
scala.collection.mutable.LinkedHashSet#addAll
is not overriden, causing unnecessary multiple allocations.In above reproduction code, LinkedHashSet is slower than HashSet about 3 times.