Skip to content

Speedups#291

Open
TeunHuijben wants to merge 3 commits intoroyerlab:mainfrom
TeunHuijben:speedups
Open

Speedups#291
TeunHuijben wants to merge 3 commits intoroyerlab:mainfrom
TeunHuijben:speedups

Conversation

@TeunHuijben
Copy link
Copy Markdown
Contributor

@TeunHuijben TeunHuijben commented May 1, 2026

Two perf fixes in GraphView, both on hot paths used by interactive editing
(BBoxSpatialFilter, GraphArrayView).

  • remove_node: replaced O(E²) bookkeeping cleanup with an O(degree) capture
    of incident edges before the node is removed. Measured on a 2000-node /
    density-5 view, 50 deletions: 52s → 2ms (~22000×).

  • update_node_attrs: when a listener is attached, the signal payload used to
    require two queries to root (old attrs + new attrs). The new attrs are now
    derived by overlaying the applied attrs onto old_attrs, saving one
    query. ~3-6× on small interactive batches with SQL backend; neutral
    otherwise.

  • Adds a benchmark for the listener-attached update_node_attrs path so the
    gain is visible in ASV comparisons going forward.

@codecov-commenter
Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 90.90909% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 87.73%. Comparing base (14b92ec) to head (5138caa).

Files with missing lines Patch % Lines
src/tracksdata/graph/_graph_view.py 90.90% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main     #291   +/-   ##
=======================================
  Coverage   87.73%   87.73%           
=======================================
  Files          57       57           
  Lines        4890     4892    +2     
  Branches      862      862           
=======================================
+ Hits         4290     4292    +2     
  Misses        378      378           
  Partials      222      222           

☔ 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.

@TeunHuijben TeunHuijben marked this pull request as ready for review May 1, 2026 22:55
@TeunHuijben TeunHuijben requested a review from JoOkuma May 1, 2026 22:55
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