You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
By default, new AbstractArray subtypes fall back to the fully generic sizeof(::Any) implementation that simply gives the size of their fields. Given that we know more about what an AbstractArray is — and given that we have a default write implementation, it seems like we should be able to do a better job of getting closer to the docstring of sizeof:
Size, in bytes, of the canonical binary representation of the given DataTypeT, if any. Size, in bytes, of object obj if it is not DataType.
So it'd seem like a sizeof(A::AbstractArray) = length(A) * sizeof(eltype(A)) definition would be better all around. If your array has a specialized canonical representation, then you define sizeof to match when you implement write.
The text was updated successfully, but these errors were encountered:
By default, new
AbstractArray
subtypes fall back to the fully genericsizeof(::Any)
implementation that simply gives the size of their fields. Given that we know more about what anAbstractArray
is — and given that we have a defaultwrite
implementation, it seems like we should be able to do a better job of getting closer to the docstring ofsizeof
:For example:
Even the "compressed" representations by default
write
their whole contents:So it'd seem like a
sizeof(A::AbstractArray) = length(A) * sizeof(eltype(A))
definition would be better all around. If your array has a specialized canonical representation, then you definesizeof
to match when you implementwrite
.The text was updated successfully, but these errors were encountered: