Optimize inserted key contains

Description

In a transaction where many entities are inserted, the performance when getting an entity is degrading at:
StatefulPersistenceCotnext.java:

insertedEntityIds list may contain more than 100.000 entries that affect performance of ArrayList.contains which has O( n ) complexity.

Please replace ArrayList with HashSet for better contains performance.

Environment

None

Activity

Show:
Leuteris Katiforis
July 9, 2020, 7:32 AM

I've refactored StatefulPersistenceContext#registerInsertedKey and StatefulPersistenceContext#wasInsertedDuringTransaction
to use HashSet instead of ArrayList.

Pull Request:

Assignee

Leuteris Katiforis

Reporter

Alex CD

Fix versions

Labels

None

backPortable

Backport?

Suitable for new contributors

None

Requires Release Note

None

Pull Request

None

backportDecision

None

Affects versions

Priority

Major
Configure