| When persistent Lists get bigger, the PersistentBag.equalsSnapshot becomes significantly slows down Hibernate queries (with FlushMode.AUTO). The implementation of this method calls countOccurrences N*2N times. When a collection has 200 items, then countOccurences is called 80 000 times and ComponentType.isSame several million times. 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. |