#include #include #include #include static auto do_sth_continuable() { return cti::make_continuable([](auto&& promise) { // promise.set_value(); }); } static void bm_continuable(benchmark::State& state) { for (auto _ : state) { cti::continuable<> cont = do_sth_continuable() .then([] { // ... return do_sth_continuable(); }) .then([] { // ... return do_sth_continuable(); }); } } BENCHMARK(bm_continuable); static boost::future do_sth_future() { boost::promise p; boost::future fu = p.get_future(); p.set_value(); return fu; } static void bm_future(benchmark::State& state) { for (auto _ : state) { auto fut = do_sth_future() .then([](auto&&) { // ... return do_sth_future(); }) .then([](auto&&) { // ... return do_sth_future(); }); // fut.get(); } } BENCHMARK(bm_future); int main(int argc, char** argv) { ::benchmark::Initialize(&argc, argv); if (::benchmark::ReportUnrecognizedArguments(argc, argv)) return 1; ::benchmark::RunSpecifiedBenchmarks(); return 0; }