Skip to content

Commit

Permalink
Use generic fallback for arrays with !(eltype >: Missing)
Browse files Browse the repository at this point in the history
  • Loading branch information
nalimilan committed Jul 5, 2018
1 parent 058ba81 commit 8f73286
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion base/missing.jl
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,10 @@ function iterate(itr::SkipMissing, state...)
end

# Optimized mapreduce implementation
mapreduce(f, op, itr::SkipMissing{<:AbstractArray}) = _mapreduce(f, op, IndexStyle(itr.x), itr)
# The generic method is faster when !(eltype(A) >: Missing) since it does not need
# additional loops to identify the two first non-missing values of each block
mapreduce(f, op, itr::SkipMissing{<:AbstractArray}) =
_mapreduce(f, op, IndexStyle(itr.x), eltype(itr.x) >: Missing ? itr : itr.x)

function _mapreduce(f, op, ::IndexLinear, itr::SkipMissing{<:AbstractArray})
A = itr.x
Expand Down

0 comments on commit 8f73286

Please sign in to comment.