Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Workaround for performance penalty of splatting a number #33108

Merged
merged 1 commit into from
Aug 29, 2019

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 #33105; 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