Skip to content

Regression for mul! from 1.9 to 1.10 #469

Open
@gdalle

Description

@gdalle

This is about in-place multiplication mul!(b, A, x) of a sparse matrix A by a vector x.
From 1.9.3 to 1.10.0-rc1, this operation

  • has gotten significantly slower
  • has started allocating when x is a view

MWE

using BenchmarkTools, LinearAlgebra, SparseArrays

function testmul(n)
    A = sparse(Float64, I, n, n)
    b = Vector{Float64}(undef, n)
    @btime mul!($b, $A, x) setup=(x=ones($n))
    @btime mul!($b, $A, x) setup=(x=view(ones($n, 1), :, 1))
    return nothing
end

testmul(1000)

Results

Julia 1.9 Julia 1.10
x vector 2.135 μs (0 allocations) 3.298 μs (0 allocations)
x view 2.502 μs (0 allocations) 4.087 μs (1 allocation)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions