HackerTube
HomeLongsLikedHistoryWatch laterCategoriesPlaylistsSettings

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

JSConf7 HN recommenders · recommended in 6 months, 2018-2023
YouTube
808K views · 8 years ago · talk · evergreen

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 why setTimeout fixes are unreliable.

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

Web developmentSoftware performance & optimization#javascript#eventloop#microtasks#requestanimationframe#settimeout#webbrowsers

9 comments from Hacker News

@mananaysiempre2023 · 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

RecommendsView on HN
@ativzzz2023 · in “Ask HN: Should I move away from JavaScript based skillset because of saturation?”

I think there's never been a better time to be a JS developer. JS is now everywhere. It runs on browsers, it runs on servers, it runs on mobile devices. You can use it as a scripting language if you really hate python and ruby. You can compile it to webassembly. There's game engines that use JS. Typescript is great as JS projects grow larger and more complex (if you can get over the fact that reading complex types is stupid) So the more and more JS devs are coming in, the more we need JS experts who really understand how stuff works at lower levels. Like for example the browser event loop - ▶ this video Being an expert that deeply understands a tech stack will never go out of style

CitesView on HN
@cassepipe2023 · 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

RecommendsView on HN
@luuuzeta2022 · in “Ask HN: Do you recall any book or course that made a topic finally click?”

I've been struggling with wrapping my head around asynchronous programming with callbacks, promises and async/await in JS, however I think it's finally clicking after watching these YouTube videos and creating a document where I explain these concepts as if I'm teaching them to someone else: * Philip Roberts's What the heck is the event loop anyway? - link * The Story of Asynchronous JavaScript - link * JavaScript Callbacks, Promises, and Async / Await Explained - link * Async Javascript Tutorial For Beginners (Callbacks, Promises, Async Await). - link * Jake Archibald: In The Loop - setTimeout, micro tasks, requestAnimationFrame, requestIdleCallback, - ▶ this video Edit... I've been rewatching these videos, reading the MDN docs, the Eloquent JavaScript book, javascript.info, blogs about the subject, etc. This further proves you shouldn't limit yourself to a single resource, and instead fill up the laguna with water from different sources if you will.

RecommendsView on HN
@phist_mcgee2020 · 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 recommendsView on HN
@memco2019 · in “Release Notes for Safari Technology Preview 81”

Just rewatched this talk on Monday from last year where Safari was called out for the rAF behavior that was fixed here. Cool to see this change. ▶ this video

CitesView on HN
@olavgg2018 · 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 recommendsView on HN
@wattengard2018 · 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 recommendsView on HN
@mxschumacher2018 · in “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: ▶ this video link 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+)!

RecommendsView on HN
What the heck is the event loop anyway? | Philip Roberts | JSConf EU26:53

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

JSConf
3.8M views • 12 years ago
Ryan Dahl: Node JS48:32

Ryan Dahl: Node JS

JSConf
35K views • 14 years ago
"Controlling Time and Space: understanding the many formulations of FRP" by Evan Czaplicki40:55

"Controlling Time and Space: understanding the many formulations of FRP" by Evan Czaplicki

Strange Loop Conference
69K views • 12 years ago
Dan Abramov: Beyond React 16 | JSConf Iceland33:25

Dan Abramov: Beyond React 16 | JSConf Iceland

JSConf
139K views • 8 years ago
Mark DiMarco: User Interface Algorithms [JSConf2014]27:42

Mark DiMarco: User Interface Algorithms [JSConf2014]

JSConf
52K views • 12 years ago
High Performance Web Sites and YSlow1:00:34

High Performance Web Sites and YSlow

Google TechTalks
90K views • 18 years ago
Speed Up Your JavaScript56:23

Speed Up Your JavaScript

Google TechTalks
136K views • 17 years ago
The Truth about Rust/WebAssembly Performance29:47

The Truth about Rust/WebAssembly Performance

Greg Johnston
218K views • 3 years ago
Chrome vs Firefox vs Safari vs Servo WebRender0:14

Chrome vs Firefox vs Safari vs Servo WebRender

Jake Archibald
121K views • 10 years ago
[JSConfUS 2013] Tom Occhino and Jordan Walke: JS Apps at Facebook18:55

[JSConfUS 2013] Tom Occhino and Jordan Walke: JS Apps at Facebook

JSConf
45K views • 13 years ago
JavaScript: Understanding the Weird Parts - The First 3.5 Hours3:32:50

JavaScript: Understanding the Weird Parts - The First 3.5 Hours

Tony Alicea
4.2M views • 11 years ago
Servo Architecture: Safety and Performance45:05

Servo Architecture: Safety and Performance

linux conf au 2017 - Hobart, Australia
12K views • 9 years ago
Netflix JavaScript Talks - Async JavaScript with Reactive Extensions28:39

Netflix JavaScript Talks - Async JavaScript with Reactive Extensions

Matt Marenghi
69K views • 12 years ago
Daniel Henry Holmes Ingalls Jr.: The Live Web. Drag 'n drop in the cloud27:21

Daniel Henry Holmes Ingalls Jr.: The Live Web. Drag 'n drop in the cloud

JSConf
8K views • 13 years ago
Hey Underscore, You're Doing It Wrong!36:31

Hey Underscore, You're Doing It Wrong!

InfoQ
141K views • 13 years ago
ReactiveConf 2017 - Tom Dale: Secrets of the Glimmer VM33:23

ReactiveConf 2017 - Tom Dale: Secrets of the Glimmer VM

ReactiveConf
3K views • 8 years ago
Servo: Building a Parallel Browser43:29

Servo: Building a Parallel Browser

Linux.conf.au 2015 -- Auckland, New Zealand
23K views • 11 years ago
Bringing SIMD to the Web via Dart27:43

Bringing SIMD to the Web via Dart

InfoQ
11K views • 13 years ago
"Make the Back-End Team Jealous: Elm in Production" by Richard Feldman31:14

"Make the Back-End Team Jealous: Elm in Production" by Richard Feldman

Strange Loop Conference
36K views • 11 years ago
A 10x faster TypeScript13:45

A 10x faster TypeScript

Microsoft Developer
608K views • 1 year ago