(Fairly) fast iteration for ReshapedArrays #5
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.
For some situations, this appears to solve the majority of performance problems with ReshapedArrays, even for complicated iteration patterns like iterating over the columns of a ReshapedArray. For the latter, the main remaining limitation is probably the fact that we can't construct allocation-free containers until they can be stored on the stack. So for ReshapedArrays with small first dimensions, it will not be so good.
Given those caveats, performance is already pretty good. Using the test at the end of
test/dense.jl
,That's within a factor of 2 of generic LinearSlow iteration; would be nice to close that, too, but this is at least progress.