eclipse / eclipse-collections

Eclipse Collections is a collections framework for Java with optimized data structures and a rich, functional and fluent API.
http://www.eclipse.org/collections
2.39k stars 593 forks source link

Optimize equals for primitive Bags using allSatisfyKeyValue on primitivePrimitive Maps #1592

Closed donraab closed 1 month ago

donraab commented 1 month ago

Before changes:

Benchmark                    Mode  Cnt      Score     Error   Units
IntBagEqualsTest.bagEquals  thrpt   20  16872.887 ±  46.903  ops/ms
IntBagEqualsTest.mapEquals  thrpt   20  15838.773 ± 103.729  ops/ms

After using allSatisfyKeyValue in primitive Bag equals:

Benchmark                    Mode  Cnt      Score     Error   Units
IntBagEqualsTest.bagEquals  thrpt   20  51903.988 ± 237.046  ops/ms
IntBagEqualsTest.mapEquals  thrpt   20  15964.766 ± 172.302  ops/ms