Since reporting the issue, major performance improvements have been made and of the 4 test-cases attached to the ticket, 3 are now faster in v6. However, one of the tests is still significantly slower and seems to have major performance implications in our application:
5.6
Main
Fetch Entities with Associations
38.74S
41.60S
Fetch Entities without Associations
23.41S
22.82S
Small Transactions Criteria
1M5.81S
56.42S
Small Transactions HQL
1M7.38S
56.19S
I just re-ran our mass indexer that issues hundreds of thousands of queries to rebuild our search index. Here are the results:
5.6.15: MassIndexerImpl - Finished updating index in 418s.
6.2.0-CR4: MassIndexerImpl - Finished updating index in 459s.
So H6 is roughly 10% slower than H5. A similar difference in performance can be seen in my minimal test case testFetchEntityWithAssociationsPerformance.
Hibernate 6 seems to do significantly more work to initialize associations than H5.
These PRs contain the performance tests against the various branches:
I tried profiling the testFetchEntityWithAssociationsPerformance test against main and 5.6, but there have been so many changes to the code between the two versions that it isn’t possible for me to determine the root cause of these regressions.
Can someone take another look at this? I think H6 has the potential to be significantly faster than H5, but the problem with associations currently makes it slower in our application.
OK, unfortunately Hibernate 6.2.2 is still about 5-10% slower for our mass indexer.
The remaining difference might not be due to slower query performance though. It is likely caused by Hibernate 6 allocating significantly more memory and causing more frequent GC.
This is the memory allocation for a full indexer run in Hibernate 5: