-
Notifications
You must be signed in to change notification settings - Fork 243
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
HSEARCH-2203 Reduce memory consumption of EntityInfoImpl objects. #1053
Conversation
indexesOfThis.add( i ); | ||
// Use THIS as placeholder. It will be replaced | ||
// when we populate the EntityInfo with the real entity. | ||
projections[i] = ProjectionConstants.THIS; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rather than reusing the String from ProjectionConstants.THIS
, I was considering using a marker object.
Would you prefer to create a (static final) singleton having just a nice toString() implementation so it doesn't get too confusing during debug?
You would still use reference equality to check for the marker, but it makes me more comfortable than doing it on a string, especially to not reuse the constant.
Thanks @golovnin , looks great! I made some minor comments, not sure if we should change them. Up to you, so I'll keep this open for some more days. Seems like you're pushing performance requirements hard? Would be nice to hear more about what you're doing and aiming at. |
So does this loose the ability "this" more than once? I doubt anyone would be doing it, but it was allowed before, so we'd at least need an entry in the migration notes. |
Why do you say that? I didn't notice. |
Yeah, seems alright. The removal of |
Uses explicit placeholder object instead of ProjectionConstants.THIS. Stores the entity instance in a field of EntityInfoImpl to avoid the iteration through the projections with instanceof attempts.
@Sanne I changed the code as you suggested. I hope that the toString()-method of EntityInfo.ENTITY_PLACEHOLDER is nice enough. :-) |
Added missed space in the if-clause.
Thanks! I integrated it. |
see https://hibernate.atlassian.net/browse/HSEARCH-2203