HackerTube

Jake Archibald on the web browser event loop, setTimeout, micro tasks, requestAnimationFrame, ...

JSConf7 HN recommenders · recommended in 6 months, 2018–2023
YouTube
talk · intermediate · evergreen · 2018–2023 on HN

Jake Archibald's JSConf.Asia 2018 talk "In the Loop" explains the browser event loop, covering tasks, microtasks, requestAnimationFrame, and how rendering interleaves with JavaScript. It uses visual walkthroughs to show why code runs in surprising orders and…

HN treats it as the best primer on the event loop, praising its entertaining, easy-to-grasp visual explanations.

9 comments from Hacker News

@phist_mcgee2020-11 · in “How does the event loop work in JavaScript? [video]”

The best primer for the event loop I have found is here: ▶ this video The speaker (Jake Archibald) has that rare ability to be both likeable and relatable, while also being incredibly knowledgeable and enthusiastic. I wish a lot more talks were like this!

Strongly recommends View on HN
@wattengard2018-10 · in “Ask HN: What are some of the best technical talks you've heard?”

Jake Archibald talking about the javascript event loop and actually making it both entertaining and easily grokable! ▶ this video

Strongly recommends View on HN
@olavgg2018-10 · in “Ask HN: What are some of the best technical talks you've heard?”

Jake Archibald's "In the Loop", Visual explanation of how the javascript event loop works! Awesome video for every javascript developer. ▶ this video

Strongly recommends View on HN
@mananaysiempre2023-10 · in “Populating the page: how browsers work”

> It basically flickers between tasks very rapidly to simulate concurrency. That’s usually used a description of preemptive multitasking, like what you get running a modern OS on a single core (on multiple cores it’s also this but on each core). Every once in a small while, the current task is made to inhale chloroform, another task is chosen to wake and takes its place. Pro: you can’t hang any given task from a single thread; con: shared memory is very difficult to impossible, as you never know when you’ll be interrupted. Browser JavaScript and UI interactions instead use cooperative multitasking, which you’ll also find in classic Mac OS, 16-bit Windows, basically every embedded system ever, and languages like Python and Lua. A task has to explicitly call out to the scheduler to hand off execution resources to the next one. Pro: as task switching only happens at clearly visible points, many of the horrors of shared memory are diminished; con: you can and will hang the UI (or other outside-world interactions) if you accidentally write an infinite loop or just do too much CPU-bound work without yielding (as any developer using one of the aforementioned systems knows). For how this works in the browser environment specifically, see Jake Archbald’s superb talk[1]. [1] ▶ this video

Recommends View on HN
@cassepipe2023-07 · in “How to think about `async`/`await` in Rust”

Coming from C and having used thread and being totally ignorant to javascript, this article really helped me grasp async in js by clearing away implicit misconceptions I held : link And also that talk on the event loop : ▶ this video

Recommends View on HN