Bug 23508


6.7, 6.6.5, 6.6.4,,, 6.6.3, 6.6.2, 6.6.1, 6.6, 6.5.8,, 6.5.7, 6.5.6, 6.5.5, 6.5.4, 6.5.2, 6.5.1, 6.5, 6.3.1, 6.3, 6.2.x, 6.2, 6.1.6, 6.1.5, 6.1.x, 6.0.x,, 5.1.5


Correction for poor performance using _asIdentityBag on large Bags/Set

The method #_asIdentityBag is used in many places to convert
an unordered collection into an IdentityBag before applying some
operation against it. While this is a no-op for IdentityBags and
IdentitySets (returning self), it involves doing a copy of elements
from the internal dictionary when applied to Bags and Sets.

For very large collections, this adversely affects performance,
and can create many temporary objects that must be garbage-collected.

This issue arises in the query operators #select:, #reject:, #detect:, and #detect:ifNone:,
although there are other callers of #_asIdentityBag that might also
benefit by recoding to avoid the extra copy operation.

Last updated: