-
Notifications
You must be signed in to change notification settings - Fork 25.6k
Pre-size collections #126382
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
Pre-size collections #126382
Conversation
|
Pinging @elastic/es-analytical-engine (Team:Analytics) |
| } else { | ||
| inputId = ne.id(); | ||
| } | ||
| Map<Integer, Layout.ChannelSet> inputChannelToOutputIds = Maps.newHashMapWithExpectedSize(projections.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.
We aren't using this collection from what I see? We're just doing a .get(), but never adding things
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.
Good catch, why do we even spend time and resources populating it then?
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 wonder, since that map is not used, does it mean we might duplicate actual data in the actual layout?
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.
Nice catch!
I think this map is unused for forever now, and people found this redundant map multiple times. I was sure one of the times, we actually had merged the fix...
I'm not sure how the channel sets were intended to be used for project, but the current project operator does shallow copies of blocks, and this works well and is intended. It didn't always do this, we had to first make it work by making blocks refcounted. Maybe before that, the channel sets were supposed to help with deduplication.
This pre-sizes collections with wisible resizing cost in profile output.