JavaScript Promise.all() and the Event Loop Explained - Let's Clarify a Previous Video

preview_player
Показать описание

_____________________________________________

Newsletter 🗞
Interested in exclusive content and discounts? 🤯 Sign up for the newsletter!
_____________________________________________

Connect with me 😀
_____________________________________________

COURSES 💻
Рекомендации по теме
Комментарии
Автор

There was a talk with title, "The main thread is overworked & underpaid" that clarified many things for me.

malipetek
Автор

I wouldn't call it "trust my instincts", but your actual knowledge. Continue doing it man, thanks for the videos

eduardotomassi
Автор

So using Promise.all you got 12x faster performance !! great information and explanaition, thank you very much James.

blue_mustang_
Автор

thanks, it made it more clarified for me and it helped me understand better this Promise.all()

nikolanikolchov
Автор

Great video! And just a little add-up: It's true that Promise.all only returns a fulfilled promise if all of the promises on the array argument settles to "fulfill" state, but actually all the promises are settled even if one of them fail; the subsequent promises after the one rejected continue to settle.

ClashRoyale-ptzj
Автор

I came from an embedded system engineering background where we used to think about Real Time Operating Systems around 2000. Interesting to see that those similar concepts come back 20 years later in JS

rembautimes
Автор

I found this guy on yt yesterday morning, subscribed to him later night that day, today I find him turned in to a soap opera. Spot on my friend. 😊

Niweera
Автор

Thanks James for your clarification and respect to your truth seeking attitude.

smashed
Автор

A concise explanation but accurate. You kicked off the haters and challenged yourself to explain the Event Loop and the technical points of the asynchronous behavior of the JS Engine. Much appreciated bro! Thanks!

jenrrycordero
Автор

i like your videos, aside from `owning your mistake`, it is short and concise easy to watch .. keep it coming man

sanzmoses
Автор

Excellent video! I was recently asked to explain the JavaScript event loop during an interview and had to say After spending some time researching it, you’re bang on on all your points. Wish I’d seen this a few days earlier!

MattKander
Автор

Nice clarification man, its good to see how you care about the content you post, good job

josesamuelproducoes
Автор

your way of explaining stuff is really commendable.

Vickyadgjmptw
Автор

Great clarification! I loved the example to show the practical application of each approach and in my opinion, that is more important than debating technical terms. Nice work 👍

brianmmdev
Автор

Good job explaining this in a simple and clear way!

I usually use an asynchronous array.reduce when wanting to wait for a fetch to be done before firing the next one, it gives a lot of flexibility and is rather simple.

cheers

SymbiosisX
Автор

2:24 thought he was about to introduce the sponsor of the video 😂😂😂😂😂

emee__
Автор

You can use console.time and console.timeEnd to know how long it takes the process instead of using dates.

DPTR
Автор

If you change the version without promise.all so that instead of creating one promise after another and awaiting each one before creating the next promise, it creates an entire array of promises (like in the promise.all version) and then loops over the promises in the array, awaiting one after the other, it's actually similarly fast as the version with promise.all. So promise.all is not strictly necessary in order to run multiple requests in parallel.
(I wrote a longer version of this comment with a link to a code snippet but it disappeared unfortunately. I think youtube must have thought it was spam)

clemensmacho
Автор

Props for making videos that most people can only comment on!

planetmall
Автор

Hey James, good job owning to your mistakes 👍

To clarify, Promise.all() has absolutely no performance benefit whatsoever. The performance difference you see in your example is coming from the fact that, in the first block, you run all promises concurrently and on the second block you await each one before running the next. If you print the elapsed time when all promises complete without the Promise.all(), you get the exact same result.