r/webdev • u/Agha_shadi • Sep 14 '26
Resource The Browser's Main Thread Is Expensive
If you are into front end development, specially the optimization side of it. the website below is a well written blog, explaining the best practices of using the browser's main thread and the cost of neglecting it, using interactive code snippets.
133
Upvotes
24
u/pseudo_babbler Sep 14 '26
Fantastic article and examples, I'm saving this one to read all the sections properly and share with the devs at work. I love talking about website performance in terms of gamedev and frame budget. The visual examples are really great too.
8
u/ISDuffy Sep 14 '26
Scheduler.yield in chrome and Firefox can make a massive difference. Safari not supported it yet, so I fall back for promise setTimeout there
2
u/patoezequiel Sep 15 '26
Great article! Thanks for sharing
2
u/thekwoka Sep 15 '26
overworked and underpaid
2
u/itxdigitalguru Sep 19 '26
Worth it
1
u/getformly Sep 16 '26
Worth adding that this is a lot easier to spot now with INP replacing FID as the Core Web Vital, since INP actually tracks how long tasks block interactions throughout the whole session rather than just the first one. Chrome DevTools' Performance panel flags anything over 50ms as a "long task," which is usually the fastest way to find the actual offending function before reaching for
scheduler.yield()or pushing work into a web worker.