Skip to content

Commit

Permalink
Remove Iterators.reverse(::Tuple) specialization (#34732)
Browse files Browse the repository at this point in the history
  • Loading branch information
tkf authored Feb 14, 2020
1 parent 438485e commit 48f942b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
1 change: 0 additions & 1 deletion base/iterators.jl
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,6 @@ reverse(G::Generator) = Generator(G.f, reverse(G.iter))
reverse(r::Reverse) = r.itr
reverse(x::Union{Number,AbstractChar}) = x
reverse(p::Pair) = Base.reverse(p) # copying pairs is cheap
reverse(xs::Tuple) = Base.reverse(xs) # allows inference in mapfoldr and similar

iterate(r::Reverse{<:Tuple}, i::Int = length(r.itr)) = i < 1 ? nothing : (r.itr[i], i-1)

Expand Down
5 changes: 4 additions & 1 deletion base/reduce.jl
Original file line number Diff line number Diff line change
Expand Up @@ -178,9 +178,12 @@ foldl(op, itr; kw...) = mapfoldl(identity, op, itr; kw...)

function mapfoldr_impl(f, op, nt, itr)
op′, itr′ = _xfadjoint(BottomRF(FlipArgs(op)), Generator(f, itr))
return foldl_impl(op′, nt, Iterators.reverse(itr′))
return foldl_impl(op′, nt, _reverse(itr′))
end

_reverse(itr) = Iterators.reverse(itr)
_reverse(itr::Tuple) = reverse(itr) #33235

struct FlipArgs{F}
f::F
end
Expand Down

2 comments on commit 48f942b

@nanosoldier
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Executing the daily benchmark build, I will reply here when finished:

@nanosoldier runbenchmarks(ALL, isdaily = true)

@nanosoldier
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your benchmark job has completed - possible performance regressions were detected. A full report can be found here. cc @ararslan

Please sign in to comment.