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

lexicographical_partition_ranges does not need to materialize indices #997

Closed
jhorstmann opened this issue Dec 3, 2021 · 0 comments · Fixed by #998
Closed

lexicographical_partition_ranges does not need to materialize indices #997

jhorstmann opened this issue Dec 3, 2021 · 0 comments · Fixed by #998
Labels
enhancement Any new improvement worthy of a entry in the changelog

Comments

@jhorstmann
Copy link
Contributor

Is your feature request related to a problem or challenge? Please describe what you are trying to do.

the lexicographical_partition_ranges function currently materializes a vector of incrementing indices, which it then uses to call slice::partition_point. The benefit is that we can directly reuse a standard rust function, the downside is that the vector of indices can be quite large and that it adds another indirection. I think by duplicating the functionality of partition_points to work with a range we could avoid this allocation and indirection.

Describe the solution you'd like
Reimplement partition_points to work with a range. The implementation in the standard library calls a relatively simple binary search which could be simplified for this usecase. The predicate could be used directly so there is no need for using the Ordering enum while searching.

@jhorstmann jhorstmann added the enhancement Any new improvement worthy of a entry in the changelog label Dec 3, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Any new improvement worthy of a entry in the changelog
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant