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

RFC: Provide selection methods based on internal iteration #164

Merged
merged 3 commits into from
Nov 3, 2024

Conversation

adamreichold
Copy link
Member

@adamreichold adamreichold commented Apr 24, 2024

  • I agree to follow the project's code of conduct.
  • I added an entry to rstar/CHANGELOG.md if knowledge of this change could be valuable to users.

This avoids the overhead of allocating an internal buffer to keep track of upcoming nodes when implementing the Iterator trait.

I also found a mistake in the old code from #37 (lack of early return in the parent case) and now the benchmarks also look somewhat nicer, i.e. directly comparing internal and external iteration on the same data set:

locate_at_point (successful)
                        time:   [115.62 ns 116.51 ns 117.43 ns]

locate_at_point_int (successful)
                        time:   [66.831 ns 67.264 ns 67.653 ns]

locate_at_point (unsuccessful)
                        time:   [167.70 ns 168.03 ns 168.34 ns]

locate_at_point_int (unsuccessful)
                        time:   [167.90 ns 168.28 ns 168.64 ns]

Closes #163

@rmanoka
Copy link
Contributor

rmanoka commented Apr 25, 2024

I'm for having this recursive impl. as an alternative to the iterator approach.

@urschrei
Copy link
Member

@adamreichold This is ready to merge, right? The only comment I have is that it would be good to have some brief documentation about when use of the new methods is preferable.

@adamreichold
Copy link
Member Author

@adamreichold This is ready to merge, right? The only comment I have is that it would be good to have some brief documentation about when use of the new methods is preferable.

Yes, this is ready to go from my part. I can add the requested documentation, but do you have a preference where to put this? On the RTree type discussing both approaches? On the new methods to contrast them with the existing ones?

This avoids the overhead of allocating an internal buffer to keep
track of upcoming nodes when implementing the `Iterator` trait.
@adamreichold
Copy link
Member Author

I added some documentation on the type level discussing the selection methods and their alternative implementations using internal iteration.

@adamreichold adamreichold added this pull request to the merge queue Nov 3, 2024
Merged via the queue into master with commit 7f8f63a Nov 3, 2024
6 checks passed
@adamreichold adamreichold deleted the internal-iteration branch November 3, 2024 20:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Avoiding SmallVec in SelectionIterator
3 participants