julia
dbc66818 - Specialize common reductions for ranges with `init` specified (#56896)

Commit
1 year ago
Specialize common reductions for ranges with `init` specified (#56896) The idea is that since ranges have `O(1)` reductions such as `minimum`, `maximum` and `sum` defined, we may reuse the implementations in the corresponding reductions with `init` specified, instead of hitting slow fallback implementations. for example, after this, ```julia julia> @btime maximum($(Ref(1:10000))[], init=typemin(Int)) 2.344 ns (0 allocations: 0 bytes) 10000 ``` whereas, on master, this is `O(N)` as it loops over each element. The specific use case is to avoid hitting slow fallbacks in a change like https://github.com/JuliaLinearAlgebra/BlockBandedMatrices.jl/pull/218/files.
Author
Parents
Loading