Fearless Concurrency with JavaScript and Beyond
summary
Compares single-threaded async (XHR, setTimeout, requestAnimationFrame) to multi-context web workers, shows a blob-spawn pattern and using postMessage transfers for big ArrayBuffers, and reports a 3.5× overhead when splitting a Fibonacci job across 100 workers versus a loop. Demonstrates sleep sort and a 1,000,000-iteration Fibonacci, shows iframe isolation is weak (renderer shared), web workers isolate runaway loops and can be terminated, notes a 512-worker Firefox limit and recommends cancelable tasks and testing offscreen canvas support.
AI-written summary · about
chapters (13)
- 0:00Introduction to talk
- 1:27Concurrency vs parallelism
- 3:37Benefits of concurrency
- 5:24Messaging between threads
- 7:29Concurrent architecture design
- 8:13Adopting concurrency in apps
- 9:28Demo sleep sort with workers
- 13:20Limitations of web workers
- 14:25Parallelization overhead demo
- 15:50Isolating malicious code
- 17:59Off-screen canvas isolation
- 19:28Pressure testing browsers
- 21:35Key takeaways and conclusion
related talks
23mMultithreading in Javascript
23mMaking Workers Work For You
25mDemystifying Web Workers and Service Workers
33mParallelism experiments in JavaScript
36mMulti-thread demystified
33mAsync patterns to scale your multicore JavaScript elegantly.
28mKeep the Main Thread Free With Web Workers
47mAdventures in Rendering Off the Main Thread
