Skip to content
0:00 / 0:00

#eventloop#v8#settimeout

What the heck is the event loop anyway? | Philip Roberts | JSConf EU

JSConf

286K subscribers • 28 videos on Hallway

YouTube
  • Recommended by 19 people: 16 on Hacker News, 2 in engineering communities and 1 curated list.
  • A classic. People kept recommending it from 2015 to 2023.
  • Presented by Philip Roberts
  • May be out of date. Uploaded 12 years ago, in an area where tools change fast.

Intermediate. Assumes working knowledge.

3.8M views12 years ago19 recommendations

Web developmentSystems programmingJavaScriptHow browsers workConcurrency and parallelism

Philip Roberts explains how the JavaScript event loop, call stack, and web APIs interact to handle asynchronous code.

JavaScript programmers like to use words like, “event-loop”, “non-blocking”, “callback”, “asynchronous”, “single-threaded” and “concurrency”. We say things like “don’t block the event loop”, “make sure your code runs at 60 frames-per-second”, “well of course, it won’t work, that function is an asynchronous callback!” If you’re anything like me, you nod and agree, as if it’s all obvious, even though you don’t actually know what the words mean; and yet, finding good explanations of how JavaScript actually works isn’t all that easy, so let’s learn! With some handy visualisations, and fun hacks, let’s get an intuitive understanding of what happens when JavaScript runs. Transcript: 2014.jsconf.eu/speakers/philip-roberts-what-the-heck-is-the-… License: For reuse of this video under a more permissive license please get in touch with us. The speakers retain the copyright for their performances.

Why it's here

19 people recommend this

What people say. Widely recommended as the single best and clearest explanation of the JavaScript event loop and concurrency model.

Moments people linked to

u/kadishayin r/Frontend • Recommends

What the heck is the event loop anyway?

u/d4nyllin r/node • Recommends

By far the best explanation of the event loop I've encountered

lollipop25on Hacker News • Recommends

On “Ask HN: How do I go about truly “understanding” JavaScript, or any language?”

> How do I take, say JS, and learn it to the point where it really clicks to the point where I can visualize what's going on under the hood when I write programs? Learn how a JS engine works. Any engine will do, although V8 is very discussed on the internet. Here's a few things to get started with: - How the event loop works ( link to this video ). This show how JS works under the hood, what's part of "JS" and what's extended, how async operations are scheduled on a single thread. After watching this, everything will just "click". - How objects are represented in V8 ( link ). It's v8-specific but nevertheless tells you how objects are represented in memory. Keeping these concepts in mind, you will be…

zappo2938on Hacker News • Recommends

On “Understanding Async JavaScript”

The corner stone of understand async JavaScript code is a deep understanding what happens under the hood with the Event loop. Philip Roberts has a great lecture called what the heck is the event loop anyway? 1 Once that video is watched once, everything else just makes sense. 1 link to this video

keyvinon Hacker News • Recommends

On “Ask HN: What are some of the best technical talks you've heard?”

Another event loop talk from Philip Roberts. The tool he created to display the event loop in real time is fantastic. link to this video

_bxg1on Hacker News • Recommends

On “Ask HN: How do I learn JavaScript?”

…ing to figure out why various things didn't work at different points, but it doesn't sound like that's your style. This isn't comprehensive, but it's probably the most helpful deep-dive I've ever seen about some aspect of JavaScript. It's about the Event Loop, which is one of the biggest differences between JS and comparable languages like Python: link to this video Contrary to what you might think, even though the event loop is in some sense "distinct from the language", it isn't simply an API. You can't really have JavaScript without the event loop; it exists in both the browser and in Node, and is the basis for most of the language's advantages.…

krisgenreon Hacker News • Recommends

On “How does the event loop work in JavaScript? [video]”

This one is my all time favorite - What the heck is the event loop anyway? | Philip Roberts | JSConf EU link to this video

programming-talkscurated list on GitHubRecommends

Under “JavaScript”

What the heck is the event loop anyway? 00:26:53 by **Philip Roberts** (2014)

the_cat_kittleson Hacker News • Recommends

On “JavaScript Call Stack/Event Loop Visualization”

i cannot believe i didn't have the mental model outlined in this video (the intro video to the site) after developing for the web for so long. link to this video ...a great, very simple explanation.

hackaflockaon Hacker News • Recommends

On “Ask HN: What's your favorite tech talk?”

Paul Buchheit - Startup School Europe 2014 link Anjana Vakil: Learning Functional Programming with JavaScript - JSUnconf 2016 link Bret Victor - Inventing on Principle link Philip Roberts: What the heck is the event loop anyway? | JSConf EU 2014 link to this video

mxschumacheron Hacker News • Recommends

On “Ask HN: What you wish you'd known before getting into JavaScript?”

Be sure to understand the event loop. Javascript as an asynchronous language often comes back to bite beginners. Here are two great talks to help you: link link to this video Your life will be easier if you learn to use Chrome Dev tools (or the Firefox equivalent) early. In the beginning, you don't have to worry about browser compatibility - embrace modern JS (ES6+)!

machiawelicznyon Hacker News • Recommends

On “Ask HN: What you wish you'd known before getting into JavaScript?”

1) Watch this: link to this video 2) Understand how `this` binding works. 3) Understand async/promises. 4) Learn debugging tools (`debugger;`, `$0`, how to turn on/off source maps etc.) 5) You will have to learn compiltion tools (babel and webpack)

mettamageon Hacker News • Recommends

On “JavaScript Is C”

Oh boy, I'm arguing over the Internet. Sorry for that. You do bring good points and I agree upfront that they are indeed JS features that either suck or are not very pedagogical. 1. You don't need to learn about the event loop straight away (or asynchronous programming) by the time you get to that concept, you might as well go to another language that's easier for that. But I do concede that once you get to async programming: JS is not the best language to learn from. With that said for people who got past the basics, here's an intuitive video about the event loop 1 (note: if you're past the basics, don't watch it while you're still doing the basics xD). 2. Basic objects are easily learnab…

hoorayimhelpingon Hacker News • Recommends

On “Eloquent JavaScript 3rd Edition (2018)”

I've been using JavaScript professionally for about 12 years. You're going to have to look for talks and really technical posts. Consider whitepapers and source code for JavaScript engines at this point. You'll probably want to start reading up on the things attached to JavaScript, rather than the language itself. Browser rendering, event loop, V8 things, garbage collection, etc. I'm sure you've seen it, but things like this: link to this video , and this: link It might be time for you to start writing what you know about JavaScript.

devxpyon Hacker News • Recommends

On “Linux containers in a few lines of code”

Yes, something like that. Like here's David's "Build Your Own Async" 1, which I prefer over Philip's (still extremely good) "What the heck is the event loop anyway?" 2. It's one thing to tell how something works, but to successfully show what the hell its actually doing under the covers, just conveys much more information. 1 link 2 link to this video

tmh88jon Hacker News • Recommends

On “Modern CI is too complex and misdirected”

Haha, I'm genuinely intrigued to see the contents of that book. It could certainly be copy/paste from the Mozilla docs, but who knows! I was pleasantly surprised by this video about the JS event loop, although in fairness it is a lecture at a conference rather than a made for youtube video. Regardless, the length of the video made me question how necessary it was but I ended up watching the whole thing and enjoyed it. link to this video