Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

core(lantern): divide throughput only on network node count #14564

Merged
merged 2 commits into from
Nov 29, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion core/lib/dependency-graph/simulator/simulator.js
Original file line number Diff line number Diff line change
Expand Up @@ -236,8 +236,11 @@ class Simulator {
* currently in flight.
*/
_updateNetworkCapacity() {
const inFlight = this._numberInProgress(BaseNode.TYPES.NETWORK);
if (inFlight === 0) return;

for (const connection of this._connectionPool.connectionsInUse()) {
connection.setThroughput(this._throughput / this._nodes[NodeState.InProgress].size);
Copy link
Member Author

@brendankenny brendankenny Nov 28, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for the historical record: the reason it did this was because the original prototype graph only had network nodes, not cpu ones. @paulirish actually noted at the time that we should make sure not to keep including all active nodes when cpu nodes were added to the graph, but we did not remember.

connection.setThroughput(this._throughput / inFlight);
}
}

Expand Down
6 changes: 3 additions & 3 deletions core/test/audits/__snapshots__/metrics-test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ Object {
"firstContentfulPaintTs": undefined,
"firstMeaningfulPaint": 2758,
"firstMeaningfulPaintTs": undefined,
"interactive": 4671,
"interactive": 4367,
"interactiveTs": undefined,
"largestContentfulPaint": 2758,
"largestContentfulPaintAllFrames": undefined,
Expand Down Expand Up @@ -173,9 +173,9 @@ Object {
"firstContentfulPaintAllFrames": undefined,
"firstContentfulPaintAllFramesTs": undefined,
"firstContentfulPaintTs": undefined,
"firstMeaningfulPaint": 1553,
"firstMeaningfulPaint": 1541,
"firstMeaningfulPaintTs": undefined,
"interactive": 4348,
"interactive": 4205,
"interactiveTs": undefined,
"largestContentfulPaint": undefined,
"largestContentfulPaintAllFrames": undefined,
Expand Down
4 changes: 2 additions & 2 deletions core/test/audits/__snapshots__/predictive-perf-test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ Object {
"pessimisticFMP": 3228,
"pessimisticLCP": 3228,
"pessimisticSI": 3047,
"pessimisticTTI": 5551,
"pessimisticTTI": 4944,
"roughEstimateOfFCP": 2289,
"roughEstimateOfFMP": 2758,
"roughEstimateOfLCP": 2758,
"roughEstimateOfSI": 3681,
"roughEstimateOfTTI": 4671,
"roughEstimateOfTTI": 4367,
}
`;
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ describe('Byte efficiency base audit', () => {
let result = await MockAudit.audit(artifacts, {settings, computedCache});
// expect modest savings
expect(result.numericValue).toBeLessThan(5000);
expect(result.numericValue).toMatchInlineSnapshot(`960`);
expect(result.numericValue).toMatchInlineSnapshot(`730`);

settings = {throttlingMethod: 'simulate', throttling: ultraSlowThrottling};
result = await MockAudit.audit(artifacts, {settings, computedCache});
Expand Down Expand Up @@ -283,8 +283,8 @@ describe('Byte efficiency base audit', () => {
const result = await MockAudit.audit(artifacts, {settings, computedCache});
const resultTti = await MockTtiAudit.audit(artifacts, {settings, computedCache});
expect(resultTti.numericValue).toBeLessThan(result.numericValue);
expect(result.numericValue).toMatchInlineSnapshot(`2120`);
expect(resultTti.numericValue).toMatchInlineSnapshot(`150`);
expect(result.numericValue).toMatchInlineSnapshot(`2280`);
expect(resultTti.numericValue).toMatchInlineSnapshot(`110`);
});

it('should allow overriding of computeWasteWithTTIGraph', async () => {
Expand Down
4 changes: 2 additions & 2 deletions core/test/audits/dobetterweb/uses-http2-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,8 @@ describe('Resources are fetched over http/2', () => {
expect(urls).not.toContain(records[30].url);
expect(result.details.items).toHaveLength(30);
// make sure we report less savings
expect(result.numericValue).toMatchInlineSnapshot(`500`);
expect(result.details.overallSavingsMs).toMatchInlineSnapshot(`500`);
expect(result.numericValue).toMatchInlineSnapshot(`320`);
expect(result.details.overallSavingsMs).toMatchInlineSnapshot(`320`);
});

it('should return table items for timespan mode', async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

exports[`Performance: first-meaningful-paint audit computes FMP correctly for simulated 1`] = `
Object {
"numericValue": 1553.2040000472914,
"numericValue": 1540.6100000208241,
"score": 0.99,
}
`;
2 changes: 1 addition & 1 deletion core/test/audits/predictive-perf-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ describe('Performance: predictive performance audit', () => {
const context = {computedCache: new Map(), settings: {locale: 'en'}};

const output = await PredictivePerf.audit(artifacts, context);
expect(output.displayValue).toBeDisplayString('4,670 ms');
expect(output.displayValue).toBeDisplayString('4,370 ms');
const metrics = output.details.items[0];
for (const [key, value] of Object.entries(metrics)) {
metrics[key] = Math.round(value);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

exports[`Metrics: FMP should compute a simulated value 1`] = `
Object {
"optimistic": 1494,
"optimistic": 1469,
"pessimistic": 1613,
"timing": 1553,
"timing": 1541,
}
`;
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

exports[`Metrics: TTI should compute a simulated value 1`] = `
Object {
"optimistic": 4313,
"pessimistic": 4383,
"timing": 4348,
"optimistic": 4177,
"pessimistic": 4233,
"timing": 4205,
}
`;
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

exports[`Metrics: Lantern FMP should compute predicted value 1`] = `
Object {
"optimistic": 1494,
"optimistic": 1469,
"pessimistic": 1613,
"timing": 1553,
"timing": 1541,
}
`;
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@

exports[`Metrics: Lantern TTI should compute predicted value 1`] = `
Object {
"optimistic": 4313,
"pessimistic": 4383,
"timing": 4348,
"optimistic": 4177,
"pessimistic": 4233,
"timing": 4205,
}
`;

exports[`Metrics: Lantern TTI should compute predicted value on iframes with substantial layout 1`] = `
Object {
"optimistic": 6657,
"pessimistic": 6692,
"timing": 6674,
"optimistic": 6207,
"pessimistic": 6242,
"timing": 6224,
}
`;
66 changes: 33 additions & 33 deletions core/test/fixtures/fraggle-rock/reports/sample-flow-result.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,41 +51,41 @@
"id": "first-contentful-paint",
"title": "First Contentful Paint",
"description": "First Contentful Paint marks the time at which the first text or image is painted. [Learn more about the First Contentful Paint metric](https://web.dev/first-contentful-paint/).",
"score": 0.98,
"score": 0.99,
"scoreDisplayMode": "numeric",
"numericValue": 1333.703,
"numericValue": 1178.7,
"numericUnit": "millisecond",
"displayValue": "1.3 s"
"displayValue": "1.2 s"
},
"largest-contentful-paint": {
"id": "largest-contentful-paint",
"title": "Largest Contentful Paint",
"description": "Largest Contentful Paint marks the time at which the largest text or image is painted. [Learn more about the Largest Contentful Paint metric](https://web.dev/lighthouse-largest-contentful-paint/)",
"score": 0.81,
"score": 0.88,
"scoreDisplayMode": "numeric",
"numericValue": 2883.733,
"numericValue": 2573.727,
"numericUnit": "millisecond",
"displayValue": "2.9 s"
"displayValue": "2.6 s"
},
"first-meaningful-paint": {
"id": "first-meaningful-paint",
"title": "First Meaningful Paint",
"description": "First Meaningful Paint measures when the primary content of a page is visible. [Learn more about the First Meaningful Paint metric](https://web.dev/first-meaningful-paint/).",
"score": 1,
"scoreDisplayMode": "numeric",
"numericValue": 1333.703,
"numericValue": 1178.7,
"numericUnit": "millisecond",
"displayValue": "1.3 s"
"displayValue": "1.2 s"
},
"speed-index": {
"id": "speed-index",
"title": "Speed Index",
"description": "Speed Index shows how quickly the contents of a page are visibly populated. [Learn more about the Speed Index metric](https://web.dev/speed-index/).",
"score": 0.99,
"score": 1,
"scoreDisplayMode": "numeric",
"numericValue": 2004.0877099943132,
"numericValue": 1903.3357599943133,
"numericUnit": "millisecond",
"displayValue": "2.0 s"
"displayValue": "1.9 s"
},
"screenshot-thumbnails": {
"id": "screenshot-thumbnails",
Expand Down Expand Up @@ -250,11 +250,11 @@
"id": "interactive",
"title": "Time to Interactive",
"description": "Time to Interactive is the amount of time it takes for the page to become fully interactive. [Learn more about the Time to Interactive metric](https://web.dev/interactive/).",
"score": 0.95,
"score": 0.96,
"scoreDisplayMode": "numeric",
"numericValue": 3074.2345000000005,
"numericValue": 2919.2315,
"numericUnit": "millisecond",
"displayValue": "3.1 s"
"displayValue": "2.9 s"
},
"user-timings": {
"id": "user-timings",
Expand Down Expand Up @@ -1239,17 +1239,17 @@
"description": "Collects all available metrics.",
"score": null,
"scoreDisplayMode": "informative",
"numericValue": 3074,
"numericValue": 2919,
"numericUnit": "millisecond",
"details": {
"type": "debugdata",
"items": [
{
"firstContentfulPaint": 1334,
"firstMeaningfulPaint": 1334,
"largestContentfulPaint": 2884,
"interactive": 3074,
"speedIndex": 2004,
"firstContentfulPaint": 1179,
"firstMeaningfulPaint": 1179,
"largestContentfulPaint": 2574,
"interactive": 2919,
"speedIndex": 1903,
"totalBlockingTime": 32,
"maxPotentialFID": 113,
"cumulativeLayoutShift": 0.009249603271484375,
Expand Down Expand Up @@ -1699,7 +1699,7 @@
{
"url": "https://www.mikescerealshack.co/_next/static/chunks/pages/index-37980adf97404e76e41a.js",
"duration": 113,
"startTime": 3038.7360000000003
"startTime": 2883.733
},
{
"url": "https://www.mikescerealshack.co/",
Expand Down Expand Up @@ -4050,7 +4050,7 @@
}
],
"id": "performance",
"score": 0.94
"score": 0.97
},
"accessibility": {
"title": "Accessibility",
Expand Down Expand Up @@ -6127,31 +6127,31 @@
"core/lib/i18n/i18n.js | seconds": [
{
"values": {
"timeInMs": 1333.703
"timeInMs": 1178.7
},
"path": "audits[first-contentful-paint].displayValue"
},
{
"values": {
"timeInMs": 2883.733
"timeInMs": 2573.727
},
"path": "audits[largest-contentful-paint].displayValue"
},
{
"values": {
"timeInMs": 1333.703
"timeInMs": 1178.7
},
"path": "audits[first-meaningful-paint].displayValue"
},
{
"values": {
"timeInMs": 2004.0877099943132
"timeInMs": 1903.3357599943133
},
"path": "audits[speed-index].displayValue"
},
{
"values": {
"timeInMs": 3074.2345000000005
"timeInMs": 2919.2315
},
"path": "audits.interactive.displayValue"
},
Expand Down Expand Up @@ -14224,11 +14224,11 @@
"id": "largest-contentful-paint",
"title": "Largest Contentful Paint",
"description": "Largest Contentful Paint marks the time at which the largest text or image is painted. [Learn more about the Largest Contentful Paint metric](https://web.dev/lighthouse-largest-contentful-paint/)",
"score": 0.97,
"score": 0.98,
"scoreDisplayMode": "numeric",
"numericValue": 1961.8806557556154,
"numericValue": 1811.8564557556156,
"numericUnit": "millisecond",
"displayValue": "2.0 s"
"displayValue": "1.8 s"
},
"first-meaningful-paint": {
"id": "first-meaningful-paint",
Expand Down Expand Up @@ -15371,7 +15371,7 @@
{
"firstContentfulPaint": 829,
"firstMeaningfulPaint": 829,
"largestContentfulPaint": 1962,
"largestContentfulPaint": 1812,
"interactive": 911,
"speedIndex": 829,
"totalBlockingTime": 21,
Expand Down Expand Up @@ -18209,7 +18209,7 @@
}
],
"id": "performance",
"score": 0.99
"score": 1
},
"accessibility": {
"title": "Accessibility",
Expand Down Expand Up @@ -20274,7 +20274,7 @@
},
{
"values": {
"timeInMs": 1961.8806557556154
"timeInMs": 1811.8564557556156
},
"path": "audits[largest-contentful-paint].displayValue"
},
Expand Down
22 changes: 11 additions & 11 deletions core/test/fixtures/lantern-baseline-accuracy.json
Original file line number Diff line number Diff line change
@@ -1,27 +1,27 @@
{
"roughEstimateOfFCP": {
"p50": 0.28115015974440893,
"p50": 0.292391744233104,
"p90": 0.49063322495742373,
"p95": 0.5191288993525603
},
"roughEstimateOfFMP": {
"p50": 0.301651376146789,
"p50": 0.3131914893617021,
"p90": 0.5385564466378778,
"p95": 0.625285684604197
"p95": 0.6417150302025346
},
"roughEstimateOfSI": {
"p50": 0.260989010989011,
"p90": 0.6901117087298304,
"p95": 0.9592408214063473
"p50": 0.2666043030869972,
"p90": 0.6462556888705007,
"p95": 0.9006036782254668
},
"roughEstimateOfTTI": {
"p50": 0.24779470729751404,
"p90": 0.6419348364220245,
"p50": 0.26245586504511575,
"p90": 0.674238788460513,
"p95": 0.743897672766033
},
"roughEstimateOfLCP": {
"p50": 0.2028301886792453,
"p90": 0.6962974535228871,
"p95": 0.9262573279851898
"p50": 0.20407433881343817,
"p90": 0.6299877796078848,
"p95": 0.8768898488120951
}
}
Loading