Open
Description
Just a little note on performance:
f(v::Vector{<:Real}, binop::F, f::Real) where {F <: Function} =
map!(
let f = f
e -> binop(e, f)
end,
v,
v)
@benchmark f(v, *, Float64x4(3)) setup=(v = rand(Float64x4, 2^14)) # median time: 260.556 μs
@benchmark f(v, *, 3.0) setup=(v = rand(Float64x4, 2^14)) # median time: 169.787 μs
@benchmark f(v, *, 0x3) setup=(v = rand(Float64x4, 2^14)) # median time: 250.470 μs
@benchmark f(v, *, Float32(3)) setup=(v = rand(Float64x4, 2^14)) # median time: 249.599 μs
Comparing the first and second benchmarks, it seems that multiplication with Float64
is special-cased, leading to very good performance.
The third and fourth benchmarks are disappointing, though, I guess that the UInt8
and Float32
are first converted to Float64x4
before the multiplication?
Perhaps converting to Float64
instead of to Float64x4
would lead to better performance? Or maybe generating special cases for multiplication with small integers or with Float32
?
Metadata
Metadata
Assignees
Labels
No labels
Activity