I have a major rewrite of this package coming up after which I plan to fully support the arrow standard so we can use it for IPC and all the other cool things all the kids these days are doing.
In the meantime, I just wanted to record here that I should be able to completely eliminate all pointers from this package and have its memory safetcy guaranteed by the memory safety of Julia. Observe!
using BenchmarkTools
const N = 128
v = zeros(UInt8, N*sizeof(Int))
function wrap(::Type{T}, v::AbstractVector, i1::Integer, ℓ::Integer) where {T}
p = convert(Ptr{T}, pointer(v) + i1)
w = unsafe_wrap(Array, p, ℓ)
copyto!(Vector{T}(undef, ℓ), w)
end
function safe(::Type{T}, v::AbstractVector, i1::Integer, ℓ::Integer) where {T}
w = reinterpret(T, @view v[i1:(i1 + ℓ*sizeof(T) - 1)])
copyto!(Vector{T}(undef, ℓ), w)
end
Note that views are now going to be of a really strange type (a reinterpret array of a view). Might have to look into whether Julia needs to add a method for reinterpreting the middle of an array.
I have a major rewrite of this package coming up after which I plan to fully support the arrow standard so we can use it for IPC and all the other cool things all the kids these days are doing.
In the meantime, I just wanted to record here that I should be able to completely eliminate all pointers from this package and have its memory safetcy guaranteed by the memory safety of Julia. Observe!
Keno is definitely a badass.
Note that views are now going to be of a really strange type (a reinterpret array of a view). Might have to look into whether Julia needs to add a method for reinterpreting the middle of an array.