Robert Jaros
02/18/2020, 1:59 PMwithContext(<http://Dispatchers.IO|Dispatchers.IO>) { }
when using ConcurrentHashMap
inside a suspending function?diesieben07
02/18/2020, 2:01 PMConcurrentHashMap
is lock-free for retrieval and overall it doesn't make much sense to switch the entire threadpool just to access a mapRobert Jaros
02/18/2020, 2:07 PMdiesieben07
02/18/2020, 2:09 PMwithContext
also has a cost, you need to create the other coroutine and schedule it (which will most likely also involve some kind of lock).
So in general it does not make much sense, imho. Of course there could be very special use-cases...spand
02/18/2020, 2:18 PMcompute
variants ;-)diesieben07
02/18/2020, 2:19 PMKroppeb
02/18/2020, 8:23 PM