-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
Open
Labels
foldsum, maximum, reduce, foldl, etc.sum, maximum, reduce, foldl, etc.performanceMust go fasterMust go faster
Description
given we had #21672
which makes reduce(vcat
and reduce(hcat
fast.
I had assumed it also applied to mapreduce
of these operations.
But it clearly does not.
julia> @btime reduce(vcat, $datas)
87.049 μs (2 allocations: 117.27 KiB)
julia> @btime mapreduce(identity, vcat, $datas);
5.372 ms (10005 allocations: 37.04 MiB)
julia> @btime reduce(vcat, map(identity, $datas));
93.212 μs (5 allocations: 156.42 KiB)
Right now, if the 2nd arg is vcat
or hcat
it is faster to call reduce(op, map(f, xs))
than mapreduce(f, op, xs)
.
And maybe that would be a solid first move to fix this.
epatters and rfourquet
Metadata
Metadata
Assignees
Labels
foldsum, maximum, reduce, foldl, etc.sum, maximum, reduce, foldl, etc.performanceMust go fasterMust go faster