https://kotlinlang.org logo
#coroutines
Title
# coroutines
r

raulraja

03/31/2019, 8:30 PM
Hi, I'm micro-benchmarking some suspended methods in Arrow and I'm wondering given I have a very simple suspend function such as:
Copy code
suspend fun test(): Int = 0
What is the fastest possible way to run the function via
startCoroutine
or similar in a blocking way to obtain
0
. This question is not specific to the coroutines-core lib but what I can do with the built in lang support for coroutines. I tried several conbinations with the EmptyCoroutineContext etc and using
CountDownLatch
and was wondering if that is the the only way to run a suspended function in a blocking way without using
runBlocking
It is internal, so don’t use it directly, but you can use the idea or just copy code to your project
r

raulraja

04/01/2019, 11:33 AM
Thanks!
4 Views