You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
From discussion on Slack with @pdeffebach, broadcasting seems to be a bit faster
using Missings, BenchmarkTools
v = Vector{Union{Float64, Missing}}(rand(10000));
@benchmark disallowmissing($v)
@benchmark Float64.($v)
The text was updated successfully, but these errors were encountered:
kescobo
changed the title
Use broadcasting instead of convert() for dropmissing()
Use broadcasting instead of convert() for disallowmissing()Jul 21, 2021
But for Vector{T} we can define a more specialized method that is faster.
Note that the benchmark above uses convert.(Float64, $v), not convert(Vector{Float64}, $v). The latter seems to be faster than convert(AbstractVector{Float64}, $v), but still slower than broadcasting.
I think these performance differences should be reported against Julia. disallowmissing isn't the problem here, it's definition is trivial.
(disallowmissing cannot use broadcasting as the element type should be preserved disregarding the actual contents of the vector.)
From discussion on Slack with @pdeffebach, broadcasting seems to be a bit faster
The text was updated successfully, but these errors were encountered: