Optimize PersistentBag.groupByEqualityHash()

Description

Hi,

I just noticed a possible optimization opportunity in PersistentBag that should save a few cycles. The idea is to:

  • introduce a check for empty inputs

  • desugar the Stream API to a vanilla loop

In an isolated benchmark this shows the following improvements for a non empty list:

For an empty list the following results are produced (testNew being the one with the additional isEmpty() check):

PR is attached.

Cheers,
Christoph

Environment

None

Status

Assignee

Christoph Dreis

Reporter

Christoph Dreis

Fix versions

Labels

None

backPortable

None

Suitable for new contributors

None

Requires Release Note

Affirmative

backportDecision

None

Components

Affects versions

Priority

Minor
Configure