Repository: mesos Updated Branches: refs/heads/1.5.x c9deac2ac -> 9d76bf7b4
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/a0e485c0 Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/a0e485c0 Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/a0e485c0 Branch: refs/heads/1.5.x Commit: a0e485c0b4b2f3301a13e33a0c146d35095494d1 Parents: c9deac2 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:33 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/a0e485c0/3rdparty/libprocess/include/process/collect.hpp ---------------------------------------------------------------------- diff --git a/3rdparty/libprocess/include/process/collect.hpp b/3rdparty/libprocess/include/process/collect.hpp index 7e07b1d..c122a98 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) {} @@ -189,7 +189,7 @@ private: } } - const std::list<Future<T>> futures; + const std::vector<Future<T>> futures; Promise<std::list<T>>* promise; size_t ready; }; @@ -203,7 +203,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) {} @@ -252,12 +252,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; };
