StrideArrays will often be heap allocated, too.
They should often SIMD. So should regular Array or StaticArrays, but StrideArrays should SIMD more reliably.
It should support that with the @gc_preserve macro, but escape analysis in the Julia compiler should eventually enable this in more situations for other types, like MArray.
The key is to GC.@preserve the memory, and then replace arrays with PtrArrays, views that don’t own the memory but otherwise act the same.
So what are StrideArrays.jl’s goals and vision?
StrideArrays’s goal is to support strided use cases as well as it can.
I believes code should return the correct answer as quickly as possible with as little effort as possible from the user.
So array operations should SIMD as much as possible, thus StrideArrays does its best to do this.
We should try and minimize the amount of allocations needed, so StrideArrays tries to do its best there.
StrideArrays also prefers a flexible flat representation, over nested layer types. The transpose of a StrideArray isn’t a Transpose{T,<:StrideArray}, but another StrideArray. Same for a view – you get a StrideArray not a SubArray, permutedims returning a StrideArrays view rather than a PermutedDimsArray wrapper, etc.
In short, this is what StrideArrays is actually about:
A flexible representation that can represent all of Array, Transpose, SubArray, PermutedDimsArray, StaticArrays, HybridArrays, etc, and nested combinations thereof.
No need for extra implementations, or introspection to peal off layers.
What StrideArrays is about is this representation. This strided representation.
Hence, the name.
Other features like SIMD and helping to cut down heap allocations are because these sorts of optimizations simply make sense to do, and are easy enough – or are simpler with one flat representation to deal with.
But the package was/is an experimental playground, so maybe that’s why the documentation and API boundary don’t have a good story?
PRs are always welcome to improve any deficiencies.
I’d also hope it is for the most part relatively easy to use. Polyester.jl turns arrays into StrideArrays under the hood, and I don’t think many people notice (other than that their code suddenly allocates a lot less vs Threads.@threads) or complain, which says something about it working reasonably well as a drop in replacement.
The biggest difference vs regular arrays is that slicing makes views by default, not copies.
Also, you should probably start Julia with --check-bounds=yes while developing.