DiskArrays.jl icon indicating copy to clipboard operation
DiskArrays.jl copied to clipboard

Wherever possible just forward `readblock!`

Open rafaqz opened this issue 1 year ago • 1 comments

It seems in a lot of cases we call getindex on the parent objects rather than just jumping straight to readblock. If for example we know the type doesn't change we don't always need to allocate another output buffer.

Calling readblock! rather than getindex also has a much lower compilation overhead.

rafaqz avatar Aug 22 '24 14:08 rafaqz

I think we need to define generic readblock on AbstractArray` for this to work generally, it broke a lot of things when I tried it locally.

rafaqz avatar Oct 18 '24 21:10 rafaqz

@meggart what do you think of this as general change in approach?

I was thinking when the type doesn't change we can just use the same allocated memory and skip around all of the getindex machinery completely for the inner arrays, which will make compilation of nested DiskArray broadcasts a lot faster and also reduce runtime allocations.

rafaqz avatar Nov 12 '24 12:11 rafaqz