Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(Fairly) fast iteration for ReshapedArrays #5

Merged
merged 4 commits into from
Apr 27, 2016
Merged

(Fairly) fast iteration for ReshapedArrays #5

merged 4 commits into from
Apr 27, 2016

Conversation

timholy
Copy link
Owner

@timholy timholy commented Apr 26, 2016

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,

julia> @time sum_cols_slow!(S1, R);   # this uses traditional CartesianIndexing
  0.180041 seconds (4 allocations: 160 bytes)

julia> @time sum_cols_fast!(S1, R);    # this uses fancy indexing over each column
  0.074804 seconds (34 allocations: 960 bytes)

That's within a factor of 2 of generic LinearSlow iteration; would be nice to close that, too, but this is at least progress.

@timholy timholy merged commit 710f812 into master Apr 27, 2016
@timholy timholy deleted the teh/reshaped branch April 27, 2016 00:43
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