Skip to content

Conversation

@tkf
Copy link
Member

@tkf tkf commented Aug 29, 2019

This PR adds a workaround for the performance penalty of splatting a number (#29114) which is problematic in mul! performance.

I don't know the time-frame of the solution of #29114 but it may make sense to have this workaround until we have a builtin solution for #29114?

close JuliaLang/LinearAlgebra.jl#661; cc @dkarrasch @KristofferC

Quick benchmarks

Before (9a8b2fd):

julia> x = rand(10); y = similar(x); λ = rand();

julia> @btime mul!($y, $λ, $x);
  938.111 ns (30 allocations: 640 bytes)

julia> @btime $y .= $λ .* $x;  # as a reference
  7.870 ns (0 allocations: 0 bytes)

After (aeaa464):

julia> @btime mul!($y, $λ, $x);
  9.506 ns (0 allocations: 0 bytes)

The difference to the broadcasting may be the @simd macro.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

linear algebra Linear algebra performance Must go faster

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Poor performance of mul! with scalar

3 participants