hfhbd
05/19/2022, 4:13 PMpublic object GlobalScope : CoroutineScope {
override val coroutineContext: CoroutineContext
get() = EmptyCoroutineContext
}
Why is coroutineContext not a field? override val coroutineContext = EmptyCoroutineContext
Joffrey
05/19/2022, 4:16 PMobject
(where any potential saving on object size in memory would likely be insignificant)Casey Brooks
05/19/2022, 4:50 PMget()
function vs a field. Since there are no fields in GlobalScope
, the JVM may be able to effectively inline the call at runtime to skip the GlobalScope
class overhead and method call invocation entirely.Dan Fingal-Surma
05/20/2022, 4:08 AMhfhbd
05/20/2022, 1:55 PMCasey Brooks
05/20/2022, 2:02 PMhfhbd
05/20/2022, 2:07 PM