Open
Description
The current 5-argument copyto!
uses scalar indexing.
julia> using DiskArrays
julia> using DiskArrays.TestTypes
julia> DiskArrays.allowscalar(false);
julia> a = ones(UInt8, 24);
julia> da = AccessCountDiskArray(a; chunksize=(4,));
julia> copyto!(zeros(UInt8,3), 1, da, 5, 3)
ERROR: Scalar indexing with `Int` is very slow, and currently is disallowed. Run DiskArrays.allowscalar(true) to allow
Stacktrace:
[1] error(s::String)
@ Base ./error.jl:35
[2] _scalar_error()
@ DiskArrays ~/github/DiskArrays.jl/src/scalar.jl:34
[3] checkscalar
@ ~/github/DiskArrays.jl/src/scalar.jl:30 [inlined]
[4] checkscalar
@ ~/github/DiskArrays.jl/src/scalar.jl:31 [inlined]
[5] getindex_disk
@ ~/github/DiskArrays.jl/src/indexing.jl:47 [inlined]
[6] getindex
@ ~/github/DiskArrays.jl/src/indexing.jl:312 [inlined]
[7] copyto!(dest::Vector{UInt8}, dstart::Int64, src::AccessCountDiskArray{UInt8, 1, Vector{UInt8}, DiskArrays.ChunkRead{DiskArrays.NoStepRange}}, sstart::Int64, n::Int64)
@ Base ./abstractarray.jl:1128
[8] top-level scope
@ REPL[31]:1
Fixing this will greatly improve performance using the reading functions on an AbstractDiskArray
wrapped in an InputBuffer
from: https://github.com/JuliaIO/InputBuffers.jl
Here is an example of what FixedSizeArray does to avoid ambiguity:
https://github.com/JuliaArrays/FixedSizeArrays.jl/blob/35fb27aac19e0cc66ae001c49202c538c4033a56/src/FixedSizeArray.jl#L359-L382
Metadata
Metadata
Assignees
Labels
No labels