Skip to content

Use :contiguous in N-index pyarray_offset - #836

Open
Beforerr wants to merge 1 commit into
JuliaPy:v1from
Beforerr:v1-pyarray-contiguous-offset
Open

Beforerr wants to merge 1 commit into
JuliaPy:v1from
Beforerr:v1-pyarray-contiguous-offset

Conversation

@Beforerr

@Beforerr Beforerr commented Oct 6, 2026

Copy link
Copy Markdown

The Vararg method of pyarray_offset ignored :contiguous. For N == 1 it's also the one picked over pyarray_offset(x, i::Int), so sum over a contiguous vector still multiplied by the runtime stride and didn't vectorise.

sum of a 1e7 Float32 vector, Julia 1.13.1, Apple M1: 4.44 ms before, 0.45 ms after, 0.44 ms for Array.

This also speeds up Cartesian indexing of contiguous N-d arrays. #835 does the same for 0.9 without the flag.

The Vararg method ignored the flag, and it is also the one picked for
1-D linear indexing, so sum over a contiguous vector didn't vectorise.

This branch has not been deployed

No deployments
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