(Wangle) Simplify reduce, use the same implementation for func returning T/Future<T>
authorHannes Roth <hannesr@fb.com>
Fri, 1 May 2015 01:38:27 +0000 (18:38 -0700)
committerPraveen Kumar Ramakrishnan <praveenr@fb.com>
Tue, 12 May 2015 00:01:58 +0000 (17:01 -0700)
commita9c6c80d31f8a035bf4d7ef729956a8e110ef777
tree9488665355cb2600d46a90edbae39a299d29ec13
parentfe381c8b35cb0eafcd65b9b692a557eb78085d8c
(Wangle) Simplify reduce, use the same implementation for func returning T/Future<T>

Summary:
I wanted to use `collectAll` for `reduce` if `func` does not return a
Future, because the overhead seemed smaller, but it has been suggested
that running the callback as soon as possible might be better. Not sure
which is. Note that this also makes n copies of the lambda and moves the
value at least n times.

I also plan to add a `streamingReduce` which calls `func` as soon as
results come in (but out of order).

Test Plan: Run all the tests.

Reviewed By: hans@fb.com

Subscribers: folly-diffs@, jsedgwick, yfeldblum, chalfant

FB internal diff: D2015316

Tasks: 6025252

Signature: t1:2015316:1430349611:4f62a540ded85299a22670dd2add27cf1458e8f8
folly/futures/Future-inl.h
folly/futures/Future.h
folly/futures/helpers.h