Commit 3b4a98dc authored by Lewis Baker's avatar Lewis Baker Committed by Facebook Github Bot

Tweak to CollectAllBenchmark

Summary: Made a slight tweak to the collectAll benchmark for the coroutine implementation to avoid allocating additional coroutine frames.

Reviewed By: andriigrynenko

Differential Revision: D17917156

fbshipit-source-id: 890a2ab33eb53050930d4547119d30a9c161887e
parent d648e0bf
...@@ -52,11 +52,8 @@ void collectAllSemiFuture(size_t batchSize) { ...@@ -52,11 +52,8 @@ void collectAllSemiFuture(size_t batchSize) {
} }
folly::coro::Task<void> co_doWork() { folly::coro::Task<void> co_doWork() {
co_await[]()->folly::coro::Task<void> { co_await folly::coro::co_reschedule_on_current_executor;
doWork(); doWork();
co_return;
}
().scheduleOn(&executor);
} }
void collectAllCoro(size_t batchSize) { void collectAllCoro(size_t batchSize) {
...@@ -66,7 +63,8 @@ void collectAllCoro(size_t batchSize) { ...@@ -66,7 +63,8 @@ void collectAllCoro(size_t batchSize) {
for (size_t i = 0; i < batchSize; ++i) { for (size_t i = 0; i < batchSize; ++i) {
co_yield co_doWork(); co_yield co_doWork();
} }
}()); }())
.scheduleOn(&executor);
}()); }());
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment