Skip to content

Commit 96c4587

Browse files
committed
Do not bother checking for key/value reference equality on update, since it is almost free to update in place
1 parent 77c7fe7 commit 96c4587

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

library/src/scala/collection/immutable/ChampHashMap.scala

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -946,11 +946,7 @@ private[immutable] final class HashMapBuilder[K, V] extends Builder[(K, V), Hash
946946
val key0UnimprovedHash = bm.getHash(index)
947947

948948
if (key0UnimprovedHash == originalHash && key0 == key) {
949-
val value0 = mapNode.getValue(index)
950-
if (!((key0.asInstanceOf[AnyRef] eq key.asInstanceOf[AnyRef]) &&
951-
(value0.asInstanceOf[AnyRef] eq value.asInstanceOf[AnyRef]))) {
952-
setValue(bm, bitpos, key, value)
953-
}
949+
setValue(bm, bitpos, key, value)
954950
} else {
955951
val value0 = bm.getValue(index)
956952
val key0Hash = improve(key0UnimprovedHash)

0 commit comments

Comments
 (0)