Closed JohnHBrock closed 9 years ago
I'm not the one who should make a final decision, but I'd be in favor of a PR that changes the README and states that ArrayViews are deprecated and should be replaced by SubArrays.
For indexing etc., SubArrays in 0.4 are indeed as fast as ArrayViews. However, constructing ArrayViews is 2-4x faster than constructing SubArrays, and constructing unsafe views is even faster. So it's a tough call.
That's not always true. For example, in this gist after warmup I currently get:
buildcols_view: 0.008320 seconds (300.00 k allocations: 13.733 MB)
buildcols_sub: 0.033081 seconds (1.20 M allocations: 41.199 MB)
buildcols_slice: 0.023696 seconds (900.00 k allocations: 32.044 MB)
buildrows_view: 0.014851 seconds (300.00 k allocations: 18.311 MB)
buildrows_sub: 0.033664 seconds (1.20 M allocations: 45.777 MB)
buildrows_slice: 0.026448 seconds (900.00 k allocations: 32.044 MB)
buildsubset_view: 0.015230 seconds (270.00 k allocations: 16.480 MB)
buildsubset_sub: 0.017131 seconds (270.00 k allocations: 20.600 MB)
buildsubset_slice: 0.016255 seconds (270.00 k allocations: 20.600 MB)
There's essentially no speed difference in the last case.
In any event, I think the best answer is to modify the README so that all the considerations are presented to the user, so s/he can make the choice.
The README briefly mentions that ArrayViews uses a more efficient representation than Base.sub. Based on the reply @timholy gave to my julia-users post, I wonder if the README should be updated with more detailed and up-to-date guidance on the advantages of ArrayViews. It sounds like julia 0.4 provides much improved array view functionality, and ArrayViews may be approaching deprecation.