Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: Add perf test to measure the "cost" of chain wakeup
The test creates a chain of future-promise-s and then wakes up the last one thus causing the cascade of resolutions. There are 2x2 tests -- resolve with value or exception vs co_await-ed or .then()-d chains. The result is (depth of 32) test iterations median mad min max allocs tasks inst cycles chain.then_value 29944640 33.158ns 0.026ns 33.059ns 33.740ns 1.063 1.094 314.9 0.0 chain.await_value 18963648 52.668ns 0.242ns 52.426ns 54.334ns 1.094 1.125 414.3 0.0 chain.then_exception 29095808 33.633ns 0.093ns 33.541ns 35.308ns 1.094 1.094 316.3 0.0 chain.await_exception 325344 3.112us 17.301ns 3.083us 3.192us 2.156 1.125 23489.0 0.0 Waking up co-await-ed chain with exceptions is extremely expensive. The result with depth of 8 are the same, which means that exception propagation via co-awaits is expensive on _every_ co_await, as it "scales" linearly with the chain depth. Signed-off-by: Pavel Emelyanov <[email protected]>
- Loading branch information