-
Notifications
You must be signed in to change notification settings - Fork 250
Set the initial capacity of ArrayLists where possible #2080
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
base: main
Are you sure you want to change the base?
Conversation
da4fc94
to
025eb9a
Compare
025eb9a
to
b5d117a
Compare
I'd like to see some data or an argument for why this is necessary. Currently, the size of our array lists isn't really something that tends to be an issue, and it might be better to avoid the added complexity this brings for such a small beenfit. |
In my mind its small added complexity for small added benefit, seems reasonable. |
Only if consistently applied across the codebase. I'd rather we stick to 100% lists without a preset size, unless test data shows that this makes a statistically significant difference on our target platforms. |
b5d117a
to
f00904d
Compare
@mcm001 @samfreund I made this at the suggestion of @Gold856 (see this comment).
Personally I think the changes in #2079 were justified. As of Java 17 the initial capacity of an ¹ In Java 17 |
I'd still like to see some performance metrics if possible. If you see the ArrayList constructor on the hotpath on roborio or older Pi platforms, I'd be more inclined to merge. |
Do you have pointers on how I would get those metrics? |
Print out how long it takes for a pipeline with and without the changes? |
Description
This can reduce reallocations of the underlying arrays.
Meta
Merge checklist: