~/talk

Keep the Main Thread Free With Web Workers

Talkat CascadiaJS 2026 · 2026-06-01..06-02· [javascript, web-performance]
slides:none on file

Five live demos show a concrete pattern: spot a 1.45s main-thread task with DevTools, move that CPU-heavy scoring loop into a Web Worker via postMessage with request IDs, and implement a predictable THREAD framework message shape. The code adds progress, cancellation, debouncing and stale-result handling, then runs a Seattle parks analysis (337 features) using Esri’s ArcGIS Maps SDK; the worker keeps the map and UI responsive while scoring and highlighting results.

AI-written summary · about

  1. 0:00Introduction: When JavaScript Freezes the UI
  2. 1:15The Goal: Responsiveness Over Raw Speed
  3. 2:47The THREAD Framework
  4. 6:08Demo 1: Triggering and Diagnosing a Freeze
  5. 9:50Understanding the Main Thread Bottleneck
  6. 10:54What Web Workers Actually Do
  7. 12:18Demo 2: Moving Work to a Web Worker
  8. 16:23Building a Worker Communication Protocol
  9. 17:22Demo 3: Progress Updates, Cancellation, and Stale Results
  10. 19:30Debouncing and Real-World Worker Patterns
  11. 21:01Demo 4: Search, Filters, and Responsive Workflows
  12. 23:18Demo 5: Seattle Parks Analysis with Web Workers
  13. 26:54When Should You Use a Web Worker?
  14. 27:18The THREAD Recap & Closing Thoughts
~/search
type to search 6,249 conferences, 138,987 speakers and 185,172 talks
~/help
cmdctrl k
search every conference, speaker and series
/
focus the filter search
h
home
c
conferences
s
speakers
e
series
t
light / dark — the status bar button does the same
?
this help
esc
close this, then clear every filter — or just the search, while you are typing in it

Ignored while you are typing. Pages without a filter rail have no search to focus.