Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR aims to reduce API overhead. For small in-memory trees the benefits can be substantial (30% or more). General ideas:
deinterleave
which is slow and does a lot of ctypes casting. This replaces it with slice assignment which is more direct and faster (for my test case tree construction goes from ~10s to ~7s).get_coordinate_pointers
. There should now be virtually no overhead from not interleaving. Moreover, point arguments should be a bit faster as we avoid some work by returning the same pointer twice.All test pass on my end, but some more cross-checking would be useful from people who have more experience with the library. Overhead is still greater than I would like but a good chunk of this is baked in due to the C API of libspatialindex (namely how indices are returned which should really be caller allocated rather than callee allocated).