diff --git a/core/audits/byte-efficiency/byte-efficiency-audit.js b/core/audits/byte-efficiency/byte-efficiency-audit.js index e56aca4446a4..84db2310f687 100644 --- a/core/audits/byte-efficiency/byte-efficiency-audit.js +++ b/core/audits/byte-efficiency/byte-efficiency-audit.js @@ -206,10 +206,10 @@ class ByteEfficiencyAudit extends Audit { if (metricComputationInput.gatherContext.gatherMode === 'navigation') { const graph = await PageDependencyGraph.request(metricComputationInput, context); const { - pessimisticGraph: pessimisticFCPGraph, + optimisticGraph: optimisticFCPGraph, } = await LanternFirstContentfulPaint.request(metricComputationInput, context); const { - pessimisticGraph: pessimisticLCPGraph, + optimisticGraph: optimisticLCPGraph, } = await LanternLargestContentfulPaint.request(metricComputationInput, context); wastedMs = this.computeWasteWithTTIGraph(results, graph, simulator, { @@ -218,17 +218,19 @@ class ByteEfficiencyAudit extends Audit { const {savings: fcpSavings} = this.computeWasteWithGraph( results, - pessimisticFCPGraph, + optimisticFCPGraph, simulator, {providedWastedBytesByUrl: result.wastedBytesByUrl, label: 'fcp'} ); + // Note: LCP's optimistic graph sometimes unexpectedly yields higher savings than the pessimistic graph. const {savings: lcpGraphSavings} = this.computeWasteWithGraph( results, - pessimisticLCPGraph, + optimisticLCPGraph, simulator, {providedWastedBytesByUrl: result.wastedBytesByUrl, label: 'lcp'} ); + // The LCP graph can underestimate the LCP savings if there is potential savings on the LCP record itself. let lcpRecordSavings = 0; const lcpRecord = await LCPImageRecord.request(metricComputationInput, context); diff --git a/core/test/results/sample_v2.json b/core/test/results/sample_v2.json index 6094b082f427..3d1fc9b57b4e 100644 --- a/core/test/results/sample_v2.json +++ b/core/test/results/sample_v2.json @@ -4457,7 +4457,7 @@ "warnings": [], "metricSavings": { "FCP": 0, - "LCP": 300 + "LCP": 610 }, "details": { "type": "opportunity", @@ -4495,7 +4495,7 @@ "type": "debugdata", "metricSavings": { "FCP": 0, - "LCP": 300 + "LCP": 610 } } }, @@ -4544,7 +4544,7 @@ "displayValue": "Potential savings of 64 KiB", "metricSavings": { "FCP": 0, - "LCP": 450 + "LCP": 300 }, "details": { "type": "opportunity", @@ -4598,7 +4598,7 @@ "type": "debugdata", "metricSavings": { "FCP": 0, - "LCP": 450 + "LCP": 300 } } }, @@ -4767,7 +4767,7 @@ "displayValue": "Potential savings of 143 KiB", "metricSavings": { "FCP": 150, - "LCP": 750 + "LCP": 1060 }, "details": { "type": "opportunity", @@ -4809,7 +4809,7 @@ "type": "debugdata", "metricSavings": { "FCP": 150, - "LCP": 750 + "LCP": 1060 } } }, @@ -4851,14 +4851,14 @@ "id": "efficient-animated-content", "title": "Use video formats for animated content", "description": "Large GIFs are inefficient for delivering animated content. Consider using MPEG4/WebM videos for animations and PNG/WebP for static images instead of GIF to save network bytes. [Learn more about efficient video formats](https://developer.chrome.com/docs/lighthouse/performance/efficient-animated-content/)", - "score": 0, + "score": 0.5, "scoreDisplayMode": "metricSavings", "numericValue": 3450, "numericUnit": "millisecond", "displayValue": "Potential savings of 666 KiB", "metricSavings": { "FCP": 0, - "LCP": 3300 + "LCP": 0 }, "details": { "type": "opportunity", @@ -4895,7 +4895,7 @@ "type": "debugdata", "metricSavings": { "FCP": 0, - "LCP": 3300 + "LCP": 0 } } }, @@ -4937,14 +4937,14 @@ "id": "legacy-javascript", "title": "Avoid serving legacy JavaScript to modern browsers", "description": "Polyfills and transforms enable legacy browsers to use new JavaScript features. However, many aren't necessary for modern browsers. For your bundled JavaScript, adopt a modern script deployment strategy using module/nomodule feature detection to reduce the amount of code shipped to modern browsers, while retaining support for legacy browsers. [Learn how to use modern JavaScript](https://web.dev/articles/publish-modern-javascript)", - "score": 0.5, + "score": 0, "scoreDisplayMode": "metricSavings", "numericValue": 450, "numericUnit": "millisecond", "displayValue": "Potential savings of 26 KiB", "metricSavings": { "FCP": 0, - "LCP": 0 + "LCP": 150 }, "details": { "type": "opportunity", @@ -5013,7 +5013,7 @@ "type": "debugdata", "metricSavings": { "FCP": 0, - "LCP": 0 + "LCP": 150 } } },