8000 Improve do_slice by jturner314 · Pull Request #575 · rust-ndarray/ndarray · GitHub
[go: up one dir, main page]

Skip to content

Improve do_slice#575

Merged
bluss merged 2 commits intorust-ndarray:masterfrom
jturner314:improve-do-slice
Dec 15, 2018
Merged

Improve do_slice#575
bluss merged 2 commits intorust-ndarray:masterfrom
jturner314:improve-do-slice

Conversation

@jturner314
Copy link
Member

This PR does two things:

  1. Avoid performing division when step.abs() == 1. This improves performance. (See slice performance #571.)
  2. Prevent overflow when calculating the new stride. This is a bug fix, and I think it's necessary for soundness.

For example, consider the case where the original axis length is `1`,
the original stride is `2`, and `step` is `isize::MAX`.
@bluss
Copy link
Member
bluss commented Dec 15, 2018

Nice!

@bluss bluss merged commit 55aca3b into rust-ndarray:master Dec 15, 2018
@jturner314 jturner314 deleted the improve-do-slice branch December 15, 2018 20:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

0