Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PERF: sorting-related improvements in Graph #715

Merged
merged 1 commit into from
May 30, 2024

Conversation

martinfleis
Copy link
Member

I've done some profiling which led to these changes.

  • avoiding re-creation of adjacency and re-sorting already sorting arrays in _sparse_to_arrays - cuts time to about half
  • faster _reorder_adjtable_by_ids (no apply) (10x faster than original)
  • _validate_sparse_input is removed as it is not used anywhere

We still do sorting multiple times in many places but if I short-circuit that, we hit #687 and issues with sparse round tripping. The final sorting either needs to happen in __init__ as now or would need to happen in .sparse. Keeping it in the constructor is probably better idea as we know that a Graph is always correct as is.

@martinfleis martinfleis self-assigned this May 30, 2024
@martinfleis martinfleis merged commit 5bda115 into pysal:main May 30, 2024
9 checks passed
@martinfleis martinfleis deleted the perf-sorting branch May 30, 2024 16:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants