-
Notifications
You must be signed in to change notification settings - Fork 933
Port Hibernate's EntityKey optimization #1972
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
For merging, I intend to squash and merge in order to reword the commit. |
Need to implement IEquitable to squeeze more performance. |
Done. |
Can you run a test again? |
The results are more or less the same:
|
I think converting |
@maca88 I've prepared a patch for this branch with EntityKey class->struct conversion: |
By just appling your patch the overall performance wasn't changed as the
By reverting the change made in We can see that struct has better performance in this case. The problem having
|
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
But memory usage dropped by ~6 megabytes. |
This PR ports Hibernate's HHH-8682, that aims to have an
EntityKey
as smallest as possible. In addition theManyToOneType.ScheduleBatchLoadIfNeeded
was modified to not generate an entity key when batching is disabled in order to reduce garbage collection. Ideally, an object pool could be implemented in order to prevent generating keys just to check if the key exist in the persistence context or not as from profiling, 35 percent of the time running the "set fetches" test is spent by the GC.Here are some benchmark results from
RawDataAccessBencher
, before:after: