JuliaArrays / JuliaArrays/BlockArrays.jl

ldiv for PseudoBlockMatrix two times slower than for native Matrix

Open
#195 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Julia
Stars
254
Forks
39
PR merge metrics
No merged PRs in 30d

Description

PseudoBlockMatrix is a structured wrapper to a native array. This is why the following came as a surprise:

using BlockArrays

n = 800
M = rand(2n,2n)
v = rand(2n)

pbM = PseudoBlockMatrix(M,[n,n],[n,n])
pbv = PseudoBlockVector(v,[n,n])

using BlockArrays.ArrayLayouts

MemoryLayout(M) == MemoryLayout(pbM)
MemoryLayout(v) == MemoryLayout(pbv)

@time u = M \ v;
@time pbu = pbM \ pbv;

output:

0.053086 seconds (4 allocations: 19.556 MiB, 9.18% gc time)
0.126742 seconds (19 allocations: 39.992 MiB, 2.13% gc time)

For matrices of larger size it remains true that solving the system with BlockPseudoArrays is two times slower. Where could this originate from?

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the benchmark from the issue using native Matrix and PseudoBlockMatrix with the \ operator, then compare allocations and timings. Trace the PseudoBlockMatrix solve path and its MemoryLayout handling to locate the slowdown; done means identifying the cause and demonstrating improved performance against the native case.

Written by the indexing model from the issue text.

Assessment

Tech stack
julia
Domain
performance
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.