Skip to content

Avoid redundant addresses.get() in sorted numeric rangeIntoBitSet#16399

Open
sgup432 wants to merge 1 commit into
apache:mainfrom
sgup432:cache_addresses_get_sorted_numeric
Open

Avoid redundant addresses.get() in sorted numeric rangeIntoBitSet#16399
sgup432 wants to merge 1 commit into
apache:mainfrom
sgup432:cache_addresses_get_sorted_numeric

Conversation

@sgup432

@sgup432 sgup432 commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

Description

While going through the doc values code where we check the value range for multi valued use-case(and cardinality is not fixed), I see we end up calling 2 decode calls for each doc like below(to calculate the number of values for a doc):

 long startOffset = addresses.get(currentDoc);      
  long endOffset = addresses.get(currentDoc + 1L);   

Seems redundant for consecutive documents. We can avoid one unnecessary addresses.get() call by storing the previous offset. This is what this PR does. Simple change.

@sgup432

sgup432 commented Jul 17, 2026

Copy link
Copy Markdown
Contributor Author

@costin @romseygeek Do you folks mind taking a look at this?

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.

1 participant