-
Notifications
You must be signed in to change notification settings - Fork 38
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
Support specific mapreduce
#301
Comments
Currently, these should be handled by FillArrays.jl/src/fillbroadcast.jl Lines 35 to 52 in 7036a50
but it might be better to specialize mapreduce instead of this internal function.
The loop seems elided already: julia> f = Fill(3, 100_000);
julia> @btime maximum($f);
2.944 ns (0 allocations: 0 bytes) |
for op in (:maximum, :minimum)
@eval $op(x::AbstractFill) = getindex_value(x)
end Anyway, julia> C = Fill(1,10000000)
10000000-element Fill{Int64}, with entries equal to 1
julia> @time mapreduce(identity, max, C)
0.000705 seconds (2 allocations: 64 bytes)
1
julia> C = Fill(1,100000000)
100000000-element Fill{Int64}, with entries equal to 1
julia> @time mapreduce(identity, max, C)
0.006655 seconds (2 allocations: 64 bytes)
1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Since
sum
,maximum
, etc. lower tomapreduce
, it might be a better idea to supportmapreduce(f, op, ::AbstractFill)
forop
at least in(:max, :min :+, :|, :&)
to supportmaximum
,minimum
,sum
,any
andall
.Examples:
The text was updated successfully, but these errors were encountered: