-
Notifications
You must be signed in to change notification settings - Fork 237
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
Feature request: clone method #65
Comments
Thanks for the request! Would you expect RBush to clone the tree structure but don't clone the items from the original input array (and keep references instead)? |
Yes, that's exactly what I'd want! |
Great! If you want to tackle this, I'm happy to review a PR. |
To keep the references, I believe current way to do it is:
|
@Pyrolistical this would be sub-optimal due to the need to perform loading again — in theory, this step could be avoided with selective tree cloning. But this probably won't be a bottleneck anyway. |
Understood. I was just showing how you would do it. Its not great. Maybe if you refactored to use a |
I've implemented clone this way:
but I imagine there might be a faster way for rbush itself to do this.
(My use case is that I'd like to create a new version of the tree with a few additional locations added.)
The text was updated successfully, but these errors were encountered: