@@ -569,13 +569,15 @@ if eltype(IIUR) === Int
569569 Base. map (:: Type{T} , r:: IdentityUnitRange ) where {T<: Real } = _indexedby (map (T, UnitRange (r)), axes (r))
570570end
571571
572- # mapreduce is faster with an IdOffsetRange than with an OffsetUnitRange
573- # We therefore convert OffsetUnitRanges to IdOffsetRanges with the same values and axes
574- function Base. mapreduce (f, op, A1:: OffsetUnitRange{<:Integer} , As:: OffsetUnitRange{<:Integer} ...; kw... )
575- As = (A1, As... )
576- ofs = map (A -> first (axes (A,1 )) - 1 , As)
577- AIds = map ((A, of) -> IdOffsetRange (_subtractoffset (parent (A), of), of), As, ofs)
578- mapreduce (f, op, AIds... ; kw... )
572+ if VERSION < v " 1.7.2"
573+ # mapreduce is faster with an IdOffsetRange than with an OffsetUnitRange on Julia 1.6
574+ # We therefore convert OffsetUnitRanges to IdOffsetRanges with the same values and axes
575+ function Base. mapreduce (f, op, A1:: OffsetUnitRange{<:Integer} , As:: OffsetUnitRange{<:Integer} ...; kw... )
576+ As = (A1, As... )
577+ ofs = map (A -> first (axes (A,1 )) - 1 , As)
578+ AIds = map ((A, of) -> IdOffsetRange (_subtractoffset (parent (A), of), of), As, ofs)
579+ mapreduce (f, op, AIds... ; kw... )
580+ end
579581end
580582
581583# Optimize certain reductions that treat an OffsetVector as a list
0 commit comments