julia
641e3f86 - Use Memory in some more fast methods (#53178)

Commit
1 year ago
Use Memory in some more fast methods (#53178) This commit changes the signature of a bunch of methods that operate on byte buffers, and which previously didn't take `Memory`. For example, a method which previously took ```julia Union{ Array{UInt8}, CodeUnits{UInt8, String}, FastContiguousSubArray{UInt8,N,<:Array{UInt8}} where N, } ``` Now also takes `Memory{UInt8}`, and the `Memory`-backed `FastContiguousSubArray`. ## Notes for reviewers 1. I don't think this is a particularly nice design - these large unions are a sign we miss an abstraction. In particular, whether something is a contiguous, memory backed Array (read or read/write). I think we should have a trait for this, which requires an implementation of e.g. `pointer` and `sizeof`. However, that's a larger PR for another time. 3. The functions `readbytes_some!` and `readbytes_all!` may resize its arguments. This will not work for `Memory`. It already didn't work for `SubArray`. Maybe we should have a different method for the arrays that can't be resized, which doesn't attempt to.
Author
Parents
Loading