Improve performance of PersistentBag.equalsSnapshot

Description

When persistent Lists get bigger, the PersistentBag.equalsSnapshot becomes significantly slows down Hibernate queries (with FlushMode.AUTO).

The implementation of this method calls countOccurrences and that calls ComponentType.isSame N*(2N) times where N is number of items in a collection. Since isSame uses reflection, it's quite slow.

I think there is quite simple optimization that can be made here. I will prepare a contribution for this.

Environment

None

Assignee

Gail Badner

Reporter

Filip Nguyen

Fix versions

Labels

None

backPortable

Backport?

Suitable for new contributors

None

Requires Release Note

None

Pull Request

None

backportDecision

None

Components

Affects versions

Priority

Major
Configure