Inline __pyx_memoryview_slice_memviewslice as C function#7558
Merged
da-woods merged 1 commit intocython:masterfrom Mar 9, 2026
Merged
Inline __pyx_memoryview_slice_memviewslice as C function#7558da-woods merged 1 commit intocython:masterfrom
da-woods merged 1 commit intocython:masterfrom
Conversation
Partial fix for cython#7521. This came up in a particular scikit-image microbenchmark so almost certainly isn't the only thing. But it looks like this particular function relies heavily on unused branches being eliminated so really wants to be inlined. On the scikit-image microbenchmark, it's now actually faster with the shared utility code than without. I'm not sure why but possibly just the effect of the inline keyword. The shared utility module itself doesn't change size at all with this fix (despite moving it to C) Alternative to cython#7557
scoder
approved these changes
Mar 9, 2026
Contributor
scoder
left a comment
There was a problem hiding this comment.
Right, there's not much of a reason to write this in Cython code that needs to be translated on each run.
scoder
pushed a commit
that referenced
this pull request
Mar 21, 2026
Partial fix for #7521 Backport to 3.2.x of #7558 This came up in a particular scikit-image microbenchmark so almost certainly isn't the only thing. But it looks like this particular function relies heavily on unused branches being eliminated so really wants to be inlined. On the scikit-image microbenchmark, it's now actually faster with the shared utility code than without. I'm not sure why but possibly just the effect of the inline keyword. The shared utility module itself shrinks by 32bytes with this fix. Alternative to #7557. I prefer this version because it has less duplication but there's some risk of errors in the translation to C.
Contributor
|
3.2.x commit is db55017 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Partial fix for #7521.
This came up in a particular scikit-image microbenchmark so almost certainly isn't the only thing. But it looks like this particular function relies heavily on unused branches being eliminated so really wants to be inlined.
On the scikit-image microbenchmark, it's now actually faster with the shared utility code than without. I'm not sure why but possibly just the effect of the inline keyword.
The shared utility module itself doesn't change size at all with this fix (despite moving it to C)
Alternative to #7557. I prefer this version because it has less duplication but there's some risk of errors in the translation to C