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
This patch rewrites `findblockindex` to compute the block and the index
in one step instead of first looking up the block and then looking up
the index.
This reduces the time for the following `getindex`-benchmark with around
50%, from 185μs to 84μs.
```julia
using BlockArrays, BenchmarkTools
const D = rand(100, 100);
const B = BlockArray(D, [50, 50], [50, 50])
function getindex_bench(A)
s = zero(eltype(A))
for j in axes(A, 2), i in axes(A, 1)
s += A[i, j]
end
return s
end
@Btime getindex_bench(B)
```
In particular this makes `BlockArray` indexing comparable to
`SparseMatrixCSC` indexing: the benchmark above, with `S = sparse(D)`,
takes 60μs.
0 commit comments