-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
Open
Labels
missing dataBase.missing and related functionalityBase.missing and related functionalityperformanceMust go fasterMust go faster
Description
Just did some benchmarking about sum
with skipmissing
. It's slower than i expected, even with skipmissing
's optimized reduce
infrastructure.
julia> x = [rand() < .2 ? missing : rand() for i in 1:100_000];
julia> y = collect(skipmissing(x));
julia> using BenchmarkTools;
julia> @btime (sum ∘ skipmissing)($x);
229.778 μs (6 allocations: 96 bytes)
julia> @btime (sum ∘ skipmissing)($x);
227.911 μs (5 allocations: 80 bytes)
julia> @btime sum($y);
12.180 μs (0 allocations: 0 bytes)
julia> @btime sum($y);
12.185 μs (0 allocations: 0 bytes)
julia> sum2(x) = sum(skipmissing(x));
julia> @btime sum2($x);
228.483 μs (5 allocations: 80 bytes)
julia> @btime sum2($x);
229.343 μs (5 allocations: 80 bytes)
Is there anything to make this faster?
Metadata
Metadata
Assignees
Labels
missing dataBase.missing and related functionalityBase.missing and related functionalityperformanceMust go fasterMust go faster