Skip to content

Speed up RangesMatrix#241

Merged
mhasself merged 7 commits intomasterfrom
mhasself/fix-ranges
Apr 22, 2026
Merged

Speed up RangesMatrix#241
mhasself merged 7 commits intomasterfrom
mhasself/fix-ranges

Conversation

@mhasself
Copy link
Copy Markdown
Member

Addresses a few slow things ...

  • len was implemented as .shape[0], which is not good.
  • getitem[int] now avoids all the slicing logic.
  • .ones / .zeros / .full now skips shape checking.
  • C++ code dealing with vector caches len and preallocates vectors.

With very rough profiling, these changes speed up processing of complex RangesMatrix objects, in C++ code, by a factor of 30 or so.

Thanks to @skhrg for identifying the inefficiencies here!

@mhasself mhasself requested review from amaurea and skhrg April 22, 2026 16:59
Copy link
Copy Markdown
Member

@skhrg skhrg left a comment

Choose a reason for hiding this comment

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

Looks good to me

@mhasself mhasself merged commit 020a241 into master Apr 22, 2026
2 checks passed
@mhasself mhasself deleted the mhasself/fix-ranges branch April 22, 2026 19:49
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