Dear all,
I’d like to present UnsafeArray.jl. It’s main function is to provide (heap-)allocation-free array views. It provides a (hopefully) safe alternative to ArrayViews.UnsafeArrayView
, and integrates with Base.view()
and Base.SubArray
.
Example:
@uviews A B C ... begin
# Within this scope, arrays A B C ... are replaced by stack-allocated (pointer-based)
# bitstype UnsafeArrays, view()'s on these are also bitstypes and stack-allocated.
# The original arrays are protected from GC, but it's the user's responsibility not to
# let the unsafe version of A B C ... escape from this scope.
end
I did some initial benchmarking, the results are quite encouraging.