Hi all, trying to wrap my head around this. The `l...
# coroutines
l
Hi all, trying to wrap my head around this. The
lookupImagesWithAsync()
should be faster since two images are downloaded in parallel, correct?
imageRepository.downloadImage(imagePath)
is a
suspend
function that does its work in
withContext(<http://Dispatchers.IO|Dispatchers.IO>)
d
Yes, it should be faster.
l
Thanks, Dominic. so in
lookupImages()
imageRepository.downloadImage("img-url-2")
does not start the download process until
imageRepository.downloadImage("img-url-1")
returns
image1
?
d
Exactly
They are synchronous.
l
ok either my way of measuring is not correct or i am just running into caching issues which make the results not what i would expect
d
Your measurement looks fine.
l
cool thanks for confirming, @Dominaezzz