Memory usage problem when using findmax/min

This is probably only tangentially related but using findmax (instead of maximum) is related to a problem in https://discourse.julialang.org/t/findmin-max-and-generators/88473/1
it was fixed/hacked there using:

Base.pairs(itr::Base.Iterators.Zip) = 
  Iterators.map(((i,v),) -> i=>v, enumerate(itr))

and then:

julia> a = rand(1_000); b = rand(1_000);

julia> @btime first(findmax(((x,y),)-> x+√y,zip($a,$b)))
  2.795 μs (0 allocations: 0 bytes)
1.9773820790088965

works.

PS If Cuda vectors don’t like zip maybe they can map:

first(findmax(Iterators.map(((x, y),)-> x+√y, a, b)))

will work.