Repository: mesos Updated Branches: refs/heads/1.4.x 623ee2fb4 -> 77a8055dc
Fixed a performance issue in collect/await. It turns out that even with C++11, some `std::list::size()` implementations are still linear in complexity. This was found when running perf against a metrics benchmark for the master. A follow-up to avoid std::list in the collect.hpp interfaces entirely is needed. Review: https://reviews.apache.org/r/67298 Project: http://git-wip-us.apache.org/repos/asf/mesos/repo Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/66237b30 Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/66237b30 Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/66237b30 Branch: refs/heads/1.4.x Commit: 66237b3054199218b98a4ebfe6fc0bd73306fe17 Parents: 623ee2f Author: Benjamin Mahler <[email protected]> Authored: Thu May 24 14:06:29 2018 -0700 Committer: Benjamin Mahler <[email protected]> Committed: Thu May 24 14:52:19 2018 -0700 ---------------------------------------------------------------------- 3rdparty/libprocess/include/process/collect.hpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/mesos/blob/66237b30/3rdparty/libprocess/include/process/collect.hpp ---------------------------------------------------------------------- diff --git a/3rdparty/libprocess/include/process/collect.hpp b/3rdparty/libprocess/include/process/collect.hpp index 43f55ca..93e5318 100644 --- a/3rdparty/libprocess/include/process/collect.hpp +++ b/3rdparty/libprocess/include/process/collect.hpp @@ -123,7 +123,7 @@ public: const std::list<Future<T>>& _futures, Promise<std::list<T>>* _promise) : ProcessBase(ID::generate("__collect__")), - futures(_futures), + futures(_futures.begin(), _futures.end()), promise(_promise), ready(0) {} @@ -176,7 +176,7 @@ private: } } - const std::list<Future<T>> futures; + const std::vector<Future<T>> futures; Promise<std::list<T>>* promise; size_t ready; }; @@ -190,7 +190,7 @@ public: const std::list<Future<T>>& _futures, Promise<std::list<Future<T>>>* _promise) : ProcessBase(ID::generate("__await__")), - futures(_futures), + futures(_futures.begin(), _futures.end()), promise(_promise), ready(0) {} @@ -227,12 +227,13 @@ private: ready += 1; if (ready == futures.size()) { - promise->set(futures); + promise->set( + std::list<Future<T>>(futures.begin(), futures.end())); terminate(this); } } - const std::list<Future<T>> futures; + const std::vector<Future<T>> futures; Promise<std::list<Future<T>>>* promise; size_t ready; };
