Це відео не доступне.
Перепрошуємо.
Avoid THIS Fatal Coroutine Mistake in Kotlin
- Додати в
- Мій плейлист
- Переглянути пізніше
- Поділитися
Поділитися
Вставка
Розмір відео:
- Опубліковано 3 січ 2023
КОМЕНТАРІ • 27
Наступне
Автоматичне відтворення
95% Don't Understand THIS About Coroutines (Main-Safety)Philipp Lackner
Переглядів 26 тис.
5 Fatal Coroutine Mistakes Nobody Tells You AboutPhilipp Lackner
Переглядів 86 тис.
#1 Что такое корутина. Важные особенности || Курс по корутинамAndroid Broadcast. Все об Андроид разработке
Переглядів 88 тис.
ВЕНГАЛБИ ПОЛУЧИЛ ПОДАРОК за 20 МЛН! Тамаев удивил Ахмеда!Асхаб Тамаев
Переглядів 6 млн
⚡️⚡️ 9 МИНУТ НАЗАД! ПОЕЗД С БОЙЦАМИ ПЕРЕВЕРНУЛИ Б@НДЕРОВЦЫ! На 60 минут ЗАБОРОНИЛИ це показувати!Курбанова LIVE
Переглядів 731 тис.
Викторина от МАМЫ 🆘 | WICSUR #shortsБискас
Переглядів 3,5 млн
Junior Developer Sent Me A PR For ReviewAmigoscode
Переглядів 166 тис.
Why didn't the Angular team just use RxJS instead of Signals?Joshua Morony
Переглядів 90 тис.
MVVM vs. MVI - Understand the Difference Once and for AllPhilipp Lackner
Переглядів 35 тис.
The Top 3 State Management Mistakes On AndroidPhilipp Lackner
Переглядів 22 тис.
Let, Also, Apply, Run, With - Kotlin Scope FunctionsPhilipp Lackner
Переглядів 94 тис.
Современная Backend Архитектура. Масштабируемые и высоконагруженные приложенияАртём Шумейко
Переглядів 346 тис.
Everything you need to know about Kotlin 2.0 🟣Stevdza-San
Переглядів 62 тис.
The Essence of CoroutinesDave Leeds
Переглядів 8 тис.
Чистка пляжа от мусора и находокFD Vasya
Переглядів 3,8 млн
Почему адаптеры Apple могут быть опасны?SuperCrastan
Переглядів 3,6 млн
Україна - Аргентина: футбол, ПРЯМА ТРАНСЛЯЦІЯ / Олімпіада-2024, вирішальний матчСуспільне Спорт
Переглядів 748 тис.
ДИНАМО - ПАРТИЗАН | ОГЛЯД МАТЧУФК «Динамо» Київ
Переглядів 505 тис.
СБЕГАЮ ОТ ЗЛЫХ РОДИТЕЛЕЙ В SCHOOLBOY RUNAAWAY В МАЙНКРАФТ!EdisonPts
Переглядів 5 млн
НРАВИТСЯ ЭТОТ ФОРМАТ??МЯТНАЯ ФАНТА
Переглядів 8 млн
Девушка приехала на СТО. Женско-водительский словарьКрасавица и Чудовище ОФИЦИАЛЬНЫЙ КАНАЛ
Переглядів 7 млн
An async block runs only in parallel if two blocks are in different threads. Otherwise, it runs concurrently.Above eg, it runs in parallel because the delay function block first async and thread become free and thread can be used by the second async. You can check it by removing the delay function function.
I was making 2 blocks of launch {} for each function . To run it in parallel
The point here is not that using deferred() allow us to perform async code, because firstly we have to know what basically executing code with deferral means.
What it really matters is that we actually perform both network calls in 2 separated and concurrent coroutines.
As the execution finishes, whether or not we are interested in their return value that's when we speak about using a deferred() or a common launch() block.
Great insight by the way
Nice opportunity to show the deferred requests for when you can make parallel network requests but you need the result of all of them to proceed
The point here is to launch coroutine separately to achieve concurrency
Just gotten into learning about coroutines. Thanks for the great tip.
Woww... this made the concept crystal clear... hats off 👏 🙌
Just like async let in Swift. Nice little video 🙂
this help me to understanding coroutine, thanks
We can achieve it with launch as well if it doesn't return anything!
This man is the goat
Without asyn it will come in single coroutine where as using async it will make both calls parallel.
From "Fatal mistake" to "mistake" to "performance tip"... Bit sensational title, no?
Very nice 👍
async-await is to decompose a task into potentially multiple running subtasks, right? so how this can be used to run independent tasks?
This would be necessary when I use retrofit network calls?
Its like js async await
Muito bom
It will still take two seconds even if you use async because runblocking doesn't execute them sequentially only.
Did you watch the video?
fatal? no! not the best performance? yes! don't clickbait with these titles
Lol, if you're making 100 network calls each taking a second, we're talking about 100s vs 1s of execution time. If that isn't fatal, what is?
@@PhilippLackner most I did is 26 api calls in one screen :D still not fatal, haha, and if that is the case it's easy to spot the issue.
By the time you might consider it" fatal" you're gonna realize that you are doing something wrong.
My point being is that if you're doing 1-2-3 apoi calls sequential is not "fatal", many times you don't even realize (not saying it's ok to do them in sequence): the app will be slightly slower but you can use it. Between 100ms to 200ms is still a usable app, not fatal!
@@hardenduroriderits absolutely fatal if you're serious about performance. I cannot sleep if my code is not perfect
@@nesletchimaew9209 haha. True in absolute terms, won't complain
awaitAll is better
Nice tip Phillip.
It's truly wrong to use coroutines like this with exception to scenarios where you actually need to make a network call first before another.