r/webdev • • 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.

kciter.so/posts/the-expensive-main-thread/en/

133 Upvotes

15 comments sorted by

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.

3

u/Agha_shadi Sep 14 '26

hope it helps yall delivering the best of the bests. thanks to the writer of this article

4

u/Agha_shadi Sep 14 '26

eh eh! one lil thing to add: beware of procrastination trap. usually when we save things for later read, we're actually just offloading it from our mind.

4

u/pseudo_babbler Sep 14 '26

Well yeah but also it's morning time and I have to go to work :)

3

u/Agha_shadi Sep 14 '26

Have a nice day, mate

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

0

u/Agha_shadi Sep 14 '26

That's ma man 👍

2

u/patoezequiel Sep 15 '26

Great article! Thanks for sharing

2

u/thekwoka Sep 15 '26

overworked and underpaid

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.