Reduce JavaScript execution time

B2C Data Innovating with Forum and Technology
Post Reply
sakibkhan22197
Posts: 31
Joined: Tue Dec 24, 2024 3:32 am

Reduce JavaScript execution time

Post by sakibkhan22197 »

For your convenience, we've added Google notes to each audit check:

: When your JavaScript takes a long time to execute, it slows down your page performance in several ways, such as network cost, parsing and compilation cost, execution cost, or memory cost;
Avoid excessive DOM size : A large DOM tree can slow cambodia phone number database down your page performance in multiple ways, such as network efficiency and loading performance, runtime performance, and memory performance;
Remove duplicate modules in JavaScript packages: The JavaScript packages on most websites are typically built by importing code from popular libraries, dependencies, and packages. This can often result in your page inheriting duplicate modules from multiple sources;


Use video formats for animated content: Large GIFs are ineffective for conveying animated content, so it's best to use video formats
Make sure text remains visible while web font loads : Fonts are often large files that take a while to load. Some browsers hide text until the font loads, causing a flash of invisible text;


Avoid serving legacy JavaScript to modern browsers: Avoid serving legacy JavaScript code (i.e. ES5 standard) to modern browsers to prevent users from downloading unnecessarily large JavaScript files;
Minimize main thread work : The browser rendering process is what turns your code into a web page that your users can interact with. By default, the main rendering thread typically handles the bulk of the code: it parses HTML and builds the DOM, parses CSS and applies specified styles, and parses, evaluates, and executes JavaScript — all of which are built on top of each other.


Avoid redirecting multiple pages : Redirects slow down your page loading speed;
Eliminate render-blocking resources : The Opportunities section of your Lighthouse report lists all the URLs that are blocking the first paint of your page. The goal is to reduce the impact of these render-blocking URLs by inlining critical resources, deferring non-critical resources, and removing anything that isn’t being used.
Reduce server response times : The Opportunities section of your Lighthouse report reports Time to First Byte, the time it takes for a user's browser to receive the first byte of page content;


Lazy loading third-party resources with facades : Third-party resources are often used to display ads or videos and integrate with social networks. The default approach is to load third-party resources as soon as the page loads, but this can unnecessarily slow down page loading. If the third-party content is not critical, this performance cost can be reduced by lazy loading it;


Reduce the impact of third-party code: To add an ad network, social media button, A/B test, or analytics service to your page, you typically need to add a third-party script to your HTML. These third-party scripts can significantly impact your page's loading performance, so you may need to add a third-party script to your page.
Avoid huge network payloads: Large network loads are highly correlated with long loading times. They also cost users money – for example, users may have to pay for more mobile data. Therefore, reducing the total size of your page’s network requests is good for your users’ experience on your site and for their wallets – and it’s also good for your users’ experience on your site.


Minify CSS: The Opportunities section of your Lighthouse report lists all unminified CSS files, along with the potential savings in kibibytes (KiB) when these files are minified;


Minify JavaScript : Minifying JavaScript files can reduce the payload size and parsing time of your scripts;
Undersized images : The image looks fine, but it is wasting user data and hurting page performance;
Remove unused CSS rules : The Opportunities section of your Lighthouse report lists all stylesheets with unused CSS with a potential savings of 2 KiB or more. Remove unused CSS to reduce unnecessary bytes consumed by network activity;
Post Reply