Skip to content

Speed up clustering with adjacency matrix compacting and BLAS sign-flip reduction - #14057

Merged
larsoner merged 1 commit into
mne-tools:mainfrom
larsoner:perf-opt-followup
Jul 14, 2026
Merged

Speed up clustering with adjacency matrix compacting and BLAS sign-flip reduction#14057
larsoner merged 1 commit into
mne-tools:mainfrom
larsoner:perf-opt-followup

Conversation

@larsoner

Copy link
Copy Markdown
Member

Follow-up to #13731. Speeds up permutation cluster functions further:

  • Reduce the connected-components graph to only the significant points
  • Skip building cluster index-array lists during the permutation loop when possible
  • Compute the sign-flip t-test via a single signs @ X reduction (should be memory safe, avoids "unsetting" the applied sign flips)

Investigated the gains and drafted initial implementation with Claude Opus 4.8. I also had it run benchmarks with py-spy (and just wall clock time) to ensure the gains were meaningful. I've also touch a couple examples that should execute faster as well.

@larsoner

Copy link
Copy Markdown
Member Author

This is a fairly straightforward speedup after #13731 so I'll mark for merge-when-green

@larsoner
larsoner enabled auto-merge (squash) July 14, 2026 21:07
@larsoner
larsoner merged commit af37b17 into mne-tools:main Jul 14, 2026
29 checks passed
@larsoner
larsoner deleted the perf-opt-followup branch July 14, 2026 21:24
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