Skip to main content

JS Resources with Duplicate Modules

Priority: Critical

Impact: Negative

What issues it may cause

  • Increased File Size: Including duplicate code increases the total size of JavaScript files, leading to longer download times.

  • Longer JavaScript Execution Time: More code takes longer to execute, which can delay the time it takes for a page to become interactive.

  • Resource Wastage: Redundant code consumes unnecessary bandwidth, memory, and CPU resources, which can affect overall performance.

  • Debugging Challenges: Having duplicated code can complicate the debugging process, making it harder to maintain clean and efficient code.

How do you fix it

  • Identify and Remove Redundant Code: Analyze your JavaScript code to find and remove any duplicates.
  • Use Common Libraries: Instead of repeating similar code across scripts, use common libraries or shared functions.

  • Optimize Bundling and Loading: Bundle your scripts and load them efficiently to avoid duplications and minimize requests.

What is the positive impact

  • Reduced File Size: Removing duplicated JavaScript reduces the total file size, improving download times and page speed.

  • Faster JavaScript Execution: Less redundant code means faster script execution, resulting in quicker time to interactive.

  • More Efficient Resource Usage: Streamlining JavaScript code improves the efficiency of bandwidth, memory, and CPU resources.

  • Easier Maintenance and Debugging: Cleaner, non-duplicated code is easier to maintain and debug, leading to better development practices.

How to fetch the data for this report template

You will need to run a crawl for report template to generate report. When report has been generated and you have crawl id you can fetch data for the report using the following query:

query GetReportForCrawl($crawlId: ObjectID!, $reportTemplateCode: String!) {
getCrawl(id: $crawlId) {
reportsByCode(
input: {
reportTypeCodes: Basic
reportTemplateCodes: [$reportTemplateCode]
}
) {
rows {
nodes {
... on CrawlSiteSpeedAuditOpportunities {
opportunityDigest
element
title
auditId
exampleUrl
wastedKibAvg
urlCount
wastedKibSum
gaPageviewsSum
savingsScoreSum
}
}
}
}
}
}

Try in explorer