Skip to content

Caching spatial_filter#215

Merged
JoOkuma merged 4 commits intoroyerlab:mainfrom
yfukai:cache_spatial_filter
Dec 10, 2025
Merged

Caching spatial_filter#215
JoOkuma merged 4 commits intoroyerlab:mainfrom
yfukai:cache_spatial_filter

Conversation

@yfukai
Copy link
Copy Markdown
Contributor

@yfukai yfukai commented Nov 23, 2025

Caching spatial_filter reduces time to build the rtree. I believe it is safe to share the spatial_filter for the same argument and therefore cache it in the BaseGraph object.

@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Nov 23, 2025

Codecov Report

❌ Patch coverage is 80.85106% with 9 lines in your changes missing coverage. Please review.
✅ Project coverage is 88.44%. Comparing base (e87a375) to head (f30b192).
⚠️ Report is 9 commits behind head on main.

Files with missing lines Patch % Lines
src/tracksdata/utils/_cache.py 73.52% 6 Missing and 3 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #215      +/-   ##
==========================================
+ Coverage   88.29%   88.44%   +0.15%     
==========================================
  Files          53       55       +2     
  Lines        3809     3869      +60     
  Branches      661      666       +5     
==========================================
+ Hits         3363     3422      +59     
  Misses        266      266              
- Partials      180      181       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Copy Markdown
Member

@JoOkuma JoOkuma left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That makes a lot of sense.
Could you add a method to clear the cache? It could be useful if the graph changed.

@yfukai
Copy link
Copy Markdown
Contributor Author

yfukai commented Dec 1, 2025

Hi @JoOkuma thanks for the suggestion, I added the clear_cache argument!
I think the filter is supposed to automatically change with #159.

@yfukai
Copy link
Copy Markdown
Contributor Author

yfukai commented Dec 9, 2025

Hi @JoOkuma, does this look okey?

@JoOkuma
Copy link
Copy Markdown
Member

JoOkuma commented Dec 9, 2025

Hi @yfukai, I apologize for missing your recent changes.

When reviewing, I forgot we already had a cache_method implemented. I moved it to its own file (_cache.py) and opened this PR with the changes, yfukai#9

What do you think?

Reusing `cache_method` for spatial filter cache
@yfukai
Copy link
Copy Markdown
Contributor Author

yfukai commented Dec 10, 2025

Thanks @JoOkuma, this looks good to me!

@JoOkuma JoOkuma merged commit 8f2828b into royerlab:main Dec 10, 2025
7 checks passed
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.

3 participants