when running this (<https://pl.kotl.in/AcLXICVsf>)...
# coroutines
j
when running this (https://pl.kotl.in/AcLXICVsf) I would have assumed that doing the context switch would make it run slower. however, it seems to have no effect on the runtime. is this a bad test or am i just misunderstanding how these work
o
with the monotonic
nanoTime
, I'm certainly seeing a small difference: https://pl.kotl.in/FHT6gAZLn
m
Switching between
.IO
and
.Default
dispatcher is implemented very efficiently and often doesn’t even change the thread.
j
okay, so this is just because i chose those two threads that there isn't a difference?
m
likely
Switching between
Main
and `Default`/`IO` should look differently.
đź‘Ť 1
j
so like if I did
.Main
for
deserializeWithContext
(on android) I would see a noticeable difference
m
I don’t know though whether it would be “noticeable” 🙂 After all switching context doesn’t mean spinning up a new thread all the time. It merely passes executions between threads and tries to do so as efficiently as possible.