Alexandre Brown
05/09/2022, 12:01 PMrunBlocking(<http://Dispatchers.IO|Dispatchers.IO>) instead of runBlocking { }, but not sure what is the immediate difference. My app is a backend so no main thread but still want to know the difference.
ThanksSam
05/09/2022, 12:06 PM<http://Dispatchers.IO|Dispatchers.IO> basically tells the coroutine not to run on one of those reserved threads.Sam
05/09/2022, 12:40 PMAlexandre Brown
05/09/2022, 12:43 PM<http://Dispatchers.IO|Dispatchers.IO> is theoretically better since it generally has a bigger thread pool that are usually for blocking tasks (not using the CPU much). I think the limit by default is 64 for <http://Dispatchers.IO|Dispatchers.IO> while Dispatchers.Default is 2x the cpu core or something like that. (I say in theory because as you mentioned the doc says they share threads to avoid context switching).Sam
05/09/2022, 12:48 PM