Skip to content

Ensure minimal number of GraphArrayView invalidation calls#300

Draft
cmalinmayor wants to merge 4 commits into
royerlab:mainfrom
cmalinmayor:targeted-updates
Draft

Ensure minimal number of GraphArrayView invalidation calls#300
cmalinmayor wants to merge 4 commits into
royerlab:mainfrom
cmalinmayor:targeted-updates

Conversation

@cmalinmayor

@cmalinmayor cmalinmayor commented Jun 3, 2026

Copy link
Copy Markdown

Currently, GraphArrayView invalidates the old and new bboxes in the cache any time any node attribute is updated, including totally unrelated ones.

Also, it appears that SQLGraph emits the signal that triggers this twice:

for node_id in updated_node_ids:
self.node_updated.emit(node_id, old_attrs_by_id[node_id], new_attrs_by_id[node_id])
and
for node_id in updated_node_ids:
self.node_updated.emit(node_id, old_attrs_by_id[node_id], new_attrs_by_id[node_id])

Every cache invalidation is expensive, and re-invaliding the same area multiple times resets any progress already made in loading.

This PR ensures the following behavior for all graph backends:

  • If the spatial bbox and attr_key are unchanged, do not invalidate the cache
  • If the spatial box is unchanged but the attr_key changes, invalidate the cache once
  • If the spatial bbox is changed, invalidate the cache twice (old and new bboxes)

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.

1 participant