Skip to content

Speedup for bounding_box_query#1104

Open
MeyerBender wants to merge 13 commits intoscverse:mainfrom
MeyerBender:main
Open

Speedup for bounding_box_query#1104
MeyerBender wants to merge 13 commits intoscverse:mainfrom
MeyerBender:main

Conversation

@MeyerBender
Copy link
Copy Markdown

Speedup for bounding_box_query(), especially in the case of many points in the object. Main improvements:

  • removed unnecessary compute() call
  • rewrote transformation logic: in the case of identity or scaling transformations, we can avoid the two-step procedure of doing a coarse query in intrinsic space and then a fine-grained on in the global coordinate space

With this, we achieved speedups between 30% and 70% (depending on the data). In the future, one could consider using a spatial index for the point to speed things up further.

@LucaMarconato it would be great if you could add a test for the case we discussed at the hackathon, just to ensure our rewrite of the transformation logic didn't break anything.

CC @dschaub95

@codecov
Copy link
Copy Markdown

codecov bot commented Apr 1, 2026

Codecov Report

❌ Patch coverage is 94.82759% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 91.95%. Comparing base (cf91ad5) to head (81f99aa).

Files with missing lines Patch % Lines
src/spatialdata/_core/query/spatial_query.py 94.82% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1104      +/-   ##
==========================================
+ Coverage   91.93%   91.95%   +0.02%     
==========================================
  Files          51       51              
  Lines        7772     7780       +8     
==========================================
+ Hits         7145     7154       +9     
+ Misses        627      626       -1     
Files with missing lines Coverage Δ
src/spatialdata/_core/query/spatial_query.py 95.54% <94.82%> (+0.36%) ⬆️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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.

2 participants