-
Notifications
You must be signed in to change notification settings - Fork 683
DATACMNS-925 - Improve memory consumption of Parameter and Parameters. #180
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
This commit changes some ArrayList initializations to use an initial capacity and avoids the unnecessary fetch of the return type of a method in Parameter.isDynamicProjectionParameter()
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.
A couple of minor comments. LGTM beyond that. Thanks for taking the time!
List<Class<?>> types = Arrays.asList(method.getParameterTypes()); | ||
|
||
this.parameters = new ArrayList<T>(types.size()); |
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.
Would you mind keeping the old position of the code and only add the initial sizing? Moving the code doesn't seem to have any effect here and types
was declared as close to its usage (the loop below) by purpose. Or do I oversee anything?
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.
I need the types variable here in order to retrieve the size. If I call method.getParameters() again I have the overhead of cloning the method parameters, which I wanted to avoid. As far as I saw, you're not yet compiling against Java 8, which would have enabled me to call Method.getParameterCount().
int pageableIndexTemp = -1; | ||
int sortIndexTemp = -1; | ||
int dynamicProjectionTemp = -1; | ||
|
||
this.parameters = new ArrayList<T>(originals.size()); |
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.
The same as above. Defining an initial size for the array seems like a good idea. However, that doesn't need the code moved.
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.
In this case your right, this was just for "consistency" to the method above. Let me know when I should change it.
This commit changes some ArrayList initializations to use an initial capacity and avoids the unnecessary fetch of the return type of a method in Parameter.isDynamicProjectionParameter(). Original pull request: #180.
Moved an assignment back to its original place to create instance state as early as possible. Original pull request: #180.
This commit changes some ArrayList initializations to use an initial capacity and avoids the unnecessary fetch of the return type of a method in Parameter.isDynamicProjectionParameter(). Original pull request: #180.
Moved an assignment back to its original place to create instance state as early as possible. Original pull request: #180.
That's merged, thanks! |
Making SimpleDiscoveryClient the default, marking NoOpDiscoveryClient as deprecated fixes spring-projectsgh-180
Fixes https://jira.spring.io/browse/DATACMNS-925