Skip to content
SEO Tools
Help and documentation
Speed Medium impact Medium 1–2 h

Less and smaller JavaScript

Large JS delays and burdens the device's CPU.

What it is

JavaScript must be downloaded, parsed, and executed, all of which costs time and performance, especially on weaker mobiles. Large JS bundles worsen interactivity (INP).

Why it matters

JS is the "most expensive" type of resource: unlike an image, the device must also process it. Redundant libraries and unused code create a needless burden.

How to do it

  1. 1Remove unused libraries and code (tree-shaking).
  2. 2Split JS by page (code splitting), load only what's needed.
  3. 3Defer non-critical scripts (defer/async).
  4. 4Consider lighter alternatives to large libraries.

Conclusion

Keep JavaScript to a minimum: every kilobyte is "paid for" twice (transfer + processing). Code splitting and removing dead code help interactivity (INP) the most. This is often the biggest opportunity on modern sites.

Related topics