Commit 534d12cd by Ben Clayton

ReactorBenchmarks: Sweep coroutine perf.

Time the Fibonacci function in iterations of 8^N, where N=[0..8] Bug: b/148660286 Change-Id: Ief391a7f6181c5907de128f5c983ac32aeadfae0 Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/40949Tested-by: 's avatarBen Clayton <bclayton@google.com> Reviewed-by: 's avatarAlexis Hétu <sugoi@google.com>
parent 693b8a8d
...@@ -27,7 +27,7 @@ public: ...@@ -27,7 +27,7 @@ public:
void TearDown(const ::benchmark::State &state) {} void TearDown(const ::benchmark::State &state) {}
}; };
BENCHMARK_F(Coroutines, Fibonacci) BENCHMARK_DEFINE_F(Coroutines, Fibonacci)
(benchmark::State &state) (benchmark::State &state)
{ {
using namespace rr; using namespace rr;
...@@ -55,9 +55,16 @@ BENCHMARK_F(Coroutines, Fibonacci) ...@@ -55,9 +55,16 @@ BENCHMARK_F(Coroutines, Fibonacci)
auto coroutine = function(); auto coroutine = function();
const auto iterations = state.range(0);
int out = 0; int out = 0;
for(auto _ : state) for(auto _ : state)
{ {
for(int64_t i = 0; i < iterations; i++)
{
coroutine->await(out); coroutine->await(out);
} }
}
} }
BENCHMARK_REGISTER_F(Coroutines, Fibonacci)->RangeMultiplier(8)->Range(1, 0x1000000)->ArgName("iterations");
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