Measuring execution time in Kotlin coroutines

    Danu Pranantha, on 11-05-2021
    Category: Development

    1. Background kotlinx.coroutines is one of the asynchronous (and concurrency) libraries in Kotlin for writing asynchronous, non-blocking code. Kotlin coroutines are cooperative subroutines that can suspend and resume their execution at any suspension point (awaiting a result). Coroutines themselves have been around since the 1960s. Coroutines are lightweight cooperative multitasking, often referred to as ‘lightweight threads.’ They yield control upon suspension. Other coroutines can then use it to start/continue their execution. Thus, they don’t depend on a scheduler and operating system. On the other hand, threads are based on the…

    Read more