Skip to content
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

SortedRanges exposes O(n^2) Patterns #3999

Open
cpwright opened this issue Jun 14, 2023 · 0 comments
Open

SortedRanges exposes O(n^2) Patterns #3999

cpwright opened this issue Jun 14, 2023 · 0 comments
Assignees
Labels
core Core development tasks feature request New feature or request query engine
Milestone

Comments

@cpwright
Copy link
Contributor

As a user, I want SortedRanges to be faster at iterative get and find so that my queries are faster.

The .get() and .find() operations on sorted ranges often end up doing something like:

for (int ii = 0; ii < index.size(); ii++) {
long kk = index.get(ii);
assertEquals(ii, index.find(kk));
}

Because of user queries and columnar access. We should consider:

  • Introducing a cardinality cache

  • Or more simply introducing a single hint (to avoid memory usage) that would let you do those N operations in O(n) instead of O(n^2). Maybe as a thread local.

@cpwright cpwright added feature request New feature or request triage labels Jun 14, 2023
@rcaudy rcaudy added query engine core Core development tasks and removed triage labels Jun 14, 2023
@rcaudy rcaudy added this to the Backlog milestone Jun 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core Core development tasks feature request New feature or request query engine
Projects
None yet
Development

No branches or pull requests

3 participants