Skip to content

Optimize GroupFacetCollector.getFacetEntries()#15947

Open
gaobinlong wants to merge 3 commits intoapache:mainfrom
gaobinlong:groupFacetCollector
Open

Optimize GroupFacetCollector.getFacetEntries()#15947
gaobinlong wants to merge 3 commits intoapache:mainfrom
gaobinlong:groupFacetCollector

Conversation

@gaobinlong
Copy link
Copy Markdown
Contributor

Description

The method GroupFacetCollector.getFacetEntries() can be optimized by:

  1. Initial ArrayList with known size.
  2. Return empty ArrayList if offset >= total size.
  3. Remove unnecessary local variable included, use entries.size() instead.

Signed-off-by: Binlong Gao <gbinlong@amazon.com>
Copy link
Copy Markdown
Contributor

@dweiss dweiss left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In all honesty, I think the previous version was easier to understand and the gain is probably minimal (if at all detectable)?

@gaobinlong
Copy link
Copy Markdown
Contributor Author

Thanks @dweiss , I reverted some change but kept the change of initial ArrayList with known size and return empty ArrayList if offset >= total size, are these also not necessary?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants