The next() call will recurse once for each document in the first set
until all iterators align, which is especially bad when the first term
is common. It will only advance the first iterator just by one, although
it could skip to the largest id in the set.
Use skipTo on each iterator until none of the iterators moves forward,
and in case the iterator has moved use the new position as new lower
bound. If one of of the iterators only contains a small set, the
iterators on average will be moved much further in each round.
As skipTo(...) and next() are mostly identical with this approach next()
can be trivially implemented with skipTo.
Depends on D28839