The main thread also processes user events. So, any time the main thread is busy doing something else, your web page may not respond to user interactions, leading to a bad experience.
How the Lighthouse main thread work audit fails
Lighthouse flags pages that keep the main thread busy for longer than 4 seconds during load:
To help you identify the sources of main thread load, Lighthouse shows a breakdown of where CPU time was spent while the browser loaded your page.
See the Lighthouse performance scoring post to learn how your page's overall performance score is calculated.
How to reduce load on the main thread
- Only send the code that your users need by implementing code splitting.
- Minify and compress your code.
- Remove unused code.
- Reduce network trips by caching your code with the PRPL pattern.
For other ways to improve page load, check out the Performance audits landing page.
- Source code for Minimize main thread work audit
- Main thread (MDN)
- Inside look at modern web browser (part 3)