diff --git a/lighthouse-core/audits/byte-efficiency/byte-efficiency-audit.js b/lighthouse-core/audits/byte-efficiency/byte-efficiency-audit.js index 9162c6c7d4a9..b4ba7d7c1c53 100644 --- a/lighthouse-core/audits/byte-efficiency/byte-efficiency-audit.js +++ b/lighthouse-core/audits/byte-efficiency/byte-efficiency-audit.js @@ -129,8 +129,8 @@ class UnusedBytes extends Audit { }); const savingsOnTTI = Math.max( - ConsistentlyInteractive.getLastLongTaskEndTime(simulationBeforeChanges.nodeTiming) - - ConsistentlyInteractive.getLastLongTaskEndTime(simulationAfterChanges.nodeTiming), + ConsistentlyInteractive.getLastLongTaskEndTime(simulationBeforeChanges.nodeTimings) - + ConsistentlyInteractive.getLastLongTaskEndTime(simulationAfterChanges.nodeTimings), 0 ); diff --git a/lighthouse-core/audits/byte-efficiency/render-blocking-resources.js b/lighthouse-core/audits/byte-efficiency/render-blocking-resources.js index fae4a1cbc9ef..4a4583dcfd7e 100644 --- a/lighthouse-core/audits/byte-efficiency/render-blocking-resources.js +++ b/lighthouse-core/audits/byte-efficiency/render-blocking-resources.js @@ -23,14 +23,14 @@ const WebInspector = require('../../lib/web-inspector'); const MINIMUM_WASTED_MS = 50; /** - * Given a simulation's nodeTiming, return an object with the nodes/timing keyed by network URL - * @param {LH.Gatherer.Simulation.Result['nodeTiming']} nodeTimingMap + * Given a simulation's nodeTimings, return an object with the nodes/timing keyed by network URL + * @param {LH.Gatherer.Simulation.Result['nodeTimings']} nodeTimings * @return {Object} */ -const getNodesAndTimingByUrl = nodeTimingMap => { - const nodes = Array.from(nodeTimingMap.keys()); +const getNodesAndTimingByUrl = nodeTimings => { + const nodes = Array.from(nodeTimings.keys()); return nodes.reduce((map, node) => { - map[node.record && node.record.url] = {node, nodeTiming: nodeTimingMap.get(node)}; + map[node.record && node.record.url] = {node, nodeTiming: nodeTimings.get(node)}; return map; }, {}); }; @@ -70,7 +70,7 @@ class RenderBlockingResources extends Audit { const fcpSimulation = await artifacts.requestFirstContentfulPaint(metricComputationData); const fcpTsInMs = traceOfTab.timestamps.firstContentfulPaint / 1000; - const nodesByUrl = getNodesAndTimingByUrl(fcpSimulation.optimisticEstimate.nodeTiming); + const nodesByUrl = getNodesAndTimingByUrl(fcpSimulation.optimisticEstimate.nodeTimings); const results = []; const deferredNodeIds = new Set(); diff --git a/lighthouse-core/gather/computed/metrics/lantern-consistently-interactive.js b/lighthouse-core/gather/computed/metrics/lantern-consistently-interactive.js index a03a69b2cfa5..4687734c5d9c 100644 --- a/lighthouse-core/gather/computed/metrics/lantern-consistently-interactive.js +++ b/lighthouse-core/gather/computed/metrics/lantern-consistently-interactive.js @@ -71,13 +71,13 @@ class ConsistentlyInteractive extends MetricArtifact { * @return {LH.Gatherer.Simulation.Result} */ getEstimateFromSimulation(simulationResult, extras) { - const lastTaskAt = ConsistentlyInteractive.getLastLongTaskEndTime(simulationResult.nodeTiming); + const lastTaskAt = ConsistentlyInteractive.getLastLongTaskEndTime(simulationResult.nodeTimings); const minimumTime = extras.optimistic ? extras.fmpResult.optimisticEstimate.timeInMs : extras.fmpResult.pessimisticEstimate.timeInMs; return { timeInMs: Math.max(minimumTime, lastTaskAt), - nodeTiming: simulationResult.nodeTiming, + nodeTimings: simulationResult.nodeTimings, }; } @@ -94,12 +94,12 @@ class ConsistentlyInteractive extends MetricArtifact { } /** - * @param {Map} nodeTiming + * @param {Map} nodeTimings * @return {number} */ - static getLastLongTaskEndTime(nodeTiming, duration = 50) { + static getLastLongTaskEndTime(nodeTimings, duration = 50) { // @ts-ignore TS can't infer how the object invariants change - return Array.from(nodeTiming.entries()) + return Array.from(nodeTimings.entries()) .filter(([node, timing]) => { if (node.type !== Node.TYPES.CPU) return false; if (!timing.endTime || !timing.startTime) return false; diff --git a/lighthouse-core/gather/computed/metrics/lantern-first-cpu-idle.js b/lighthouse-core/gather/computed/metrics/lantern-first-cpu-idle.js index d220a3c70a54..b7aea76615af 100644 --- a/lighthouse-core/gather/computed/metrics/lantern-first-cpu-idle.js +++ b/lighthouse-core/gather/computed/metrics/lantern-first-cpu-idle.js @@ -28,20 +28,20 @@ class LanternFirstCPUIdle extends LanternConsistentlyInteractive { : extras.fmpResult.pessimisticEstimate.timeInMs; return { - timeInMs: LanternFirstCPUIdle.getFirstCPUIdleWindowStart(simulation.nodeTiming, fmpTimeInMs), - nodeTiming: simulation.nodeTiming, + timeInMs: LanternFirstCPUIdle.getFirstCPUIdleWindowStart(simulation.nodeTimings, fmpTimeInMs), + nodeTimings: simulation.nodeTimings, }; } /** * - * @param {Map} nodeTiming + * @param {Map} nodeTimings * @param {number} fmpTimeInMs */ - static getFirstCPUIdleWindowStart(nodeTiming, fmpTimeInMs, longTaskLength = 50) { + static getFirstCPUIdleWindowStart(nodeTimings, fmpTimeInMs, longTaskLength = 50) { /** @type {Array<{start: number, end: number}>} */ const longTasks = []; - for (const [node, timing] of nodeTiming.entries()) { + for (const [node, timing] of nodeTimings.entries()) { if (node.type !== Node.TYPES.CPU) continue; if (!timing.endTime || !timing.startTime) continue; if (timing.endTime - timing.startTime < longTaskLength) continue; diff --git a/lighthouse-core/gather/computed/metrics/lantern-speed-index.js b/lighthouse-core/gather/computed/metrics/lantern-speed-index.js index 35b0c092c86c..472688050317 100644 --- a/lighthouse-core/gather/computed/metrics/lantern-speed-index.js +++ b/lighthouse-core/gather/computed/metrics/lantern-speed-index.js @@ -50,10 +50,10 @@ class SpeedIndex extends MetricArtifact { const fcpTimeInMs = extras.fcpResult.timing; const estimate = extras.optimistic ? extras.speedline.speedIndex - : SpeedIndex.computeLayoutBasedSpeedIndex(simulationResult.nodeTiming, fcpTimeInMs); + : SpeedIndex.computeLayoutBasedSpeedIndex(simulationResult.nodeTimings, fcpTimeInMs); return { timeInMs: estimate, - nodeTiming: simulationResult.nodeTiming, + nodeTimings: simulationResult.nodeTimings, }; } @@ -84,14 +84,14 @@ class SpeedIndex extends MetricArtifact { * different methods. Read more in the evaluation doc. * * @see https://docs.google.com/document/d/1qJWXwxoyVLVadezIp_Tgdk867G3tDNkkVRvUJSH3K1E/edit# - * @param {Map} nodeTiming + * @param {Map} nodeTimings * @param {number} fcpTimeInMs * @return {number} */ - static computeLayoutBasedSpeedIndex(nodeTiming, fcpTimeInMs) { + static computeLayoutBasedSpeedIndex(nodeTimings, fcpTimeInMs) { /** @type {Array<{time: number, weight: number}>} */ const layoutWeights = []; - for (const [node, timing] of nodeTiming.entries()) { + for (const [node, timing] of nodeTimings.entries()) { if (node.type !== Node.TYPES.CPU) continue; if (!timing.startTime || !timing.endTime) continue; diff --git a/lighthouse-core/lib/dependency-graph/simulator/simulator.js b/lighthouse-core/lib/dependency-graph/simulator/simulator.js index 38980326454e..5b8f4d6230e4 100644 --- a/lighthouse-core/lib/dependency-graph/simulator/simulator.js +++ b/lighthouse-core/lib/dependency-graph/simulator/simulator.js @@ -52,7 +52,7 @@ class Simulator { this._layoutTaskMultiplier = this._cpuSlowdownMultiplier * this._options.layoutTaskMultiplier; // Properties reset on every `.simulate` call but duplicated here for type checking - this._nodeTiming = new Map(); + this._nodeTimings = new Map(); this._numberInProgressByType = new Map(); this._nodes = {}; // @ts-ignore @@ -78,7 +78,7 @@ class Simulator { * Initializes the various state data structures such as _nodesReadyToStart and _nodesCompleted. */ _initializeAuxiliaryData() { - this._nodeTiming = new Map(); + this._nodeTimings = new Map(); this._numberInProgressByType = new Map(); this._nodes = {}; @@ -100,9 +100,9 @@ class Simulator { * @param {LH.Gatherer.Simulation.NodeTiming} values */ _setTimingData(node, values) { - const timingData = this._nodeTiming.get(node) || {}; + const timingData = this._nodeTimings.get(node) || {}; Object.assign(timingData, values); - this._nodeTiming.set(node, timingData); + this._nodeTimings.set(node, timingData); } /** @@ -195,7 +195,7 @@ class Simulator { */ _estimateTimeRemaining(node) { if (node.type === Node.TYPES.CPU) { - const timingData = this._nodeTiming.get(node); + const timingData = this._nodeTimings.get(node); const multiplier = /** @type {CpuNode} */ (node).didPerformLayout() ? this._layoutTaskMultiplier : this._cpuSlowdownMultiplier; @@ -211,7 +211,7 @@ class Simulator { if (node.type !== Node.TYPES.NETWORK) throw new Error('Unsupported'); const record = /** @type {NetworkNode} */ (node).record; - const timingData = this._nodeTiming.get(node); + const timingData = this._nodeTimings.get(node); const connection = /** @type {TcpConnection} */ (this._connectionPool.acquire(record)); const calculation = connection.simulateDownloadUntil( record.transferSize - timingData.bytesDownloaded, @@ -243,7 +243,7 @@ class Simulator { * @param {number} totalElapsedTime */ _updateProgressMadeInTimePeriod(node, timePeriodLength, totalElapsedTime) { - const timingData = this._nodeTiming.get(node); + const timingData = this._nodeTimings.get(node); const isFinished = timingData.estimatedTimeElapsed === timePeriodLength; if (node.type === Node.TYPES.CPU) { @@ -329,7 +329,7 @@ class Simulator { return { timeInMs: totalElapsedTime, - nodeTiming: this._nodeTiming, + nodeTimings: this._nodeTimings, }; } } diff --git a/lighthouse-core/test/gather/computed/metrics/consistently-interactive-test.js b/lighthouse-core/test/gather/computed/metrics/consistently-interactive-test.js index d3a58335d1a6..11d4b8046dd8 100644 --- a/lighthouse-core/test/gather/computed/metrics/consistently-interactive-test.js +++ b/lighthouse-core/test/gather/computed/metrics/consistently-interactive-test.js @@ -34,8 +34,8 @@ describe('Metrics: TTCI', () => { assert.equal(Math.round(result.timing), 5308); assert.equal(Math.round(result.optimisticEstimate.timeInMs), 2451); assert.equal(Math.round(result.pessimisticEstimate.timeInMs), 2752); - assert.equal(result.optimisticEstimate.nodeTiming.size, 19); - assert.equal(result.pessimisticEstimate.nodeTiming.size, 79); + assert.equal(result.optimisticEstimate.nodeTimings.size, 19); + assert.equal(result.pessimisticEstimate.nodeTimings.size, 79); assert.ok(result.optimisticGraph, 'should have created optimistic graph'); assert.ok(result.pessimisticGraph, 'should have created pessimistic graph'); }); diff --git a/lighthouse-core/test/gather/computed/metrics/first-contentful-paint-test.js b/lighthouse-core/test/gather/computed/metrics/first-contentful-paint-test.js index 33c282f0cfe2..40e8e266ab6a 100644 --- a/lighthouse-core/test/gather/computed/metrics/first-contentful-paint-test.js +++ b/lighthouse-core/test/gather/computed/metrics/first-contentful-paint-test.js @@ -22,8 +22,8 @@ describe('Metrics: FCP', () => { assert.equal(Math.round(result.timing), 2038); assert.equal(Math.round(result.optimisticEstimate.timeInMs), 611); assert.equal(Math.round(result.pessimisticEstimate.timeInMs), 611); - assert.equal(result.optimisticEstimate.nodeTiming.size, 2); - assert.equal(result.pessimisticEstimate.nodeTiming.size, 2); + assert.equal(result.optimisticEstimate.nodeTimings.size, 2); + assert.equal(result.pessimisticEstimate.nodeTimings.size, 2); assert.ok(result.optimisticGraph, 'should have created optimistic graph'); assert.ok(result.pessimisticGraph, 'should have created pessimistic graph'); }); diff --git a/lighthouse-core/test/gather/computed/metrics/first-cpu-idle-test.js b/lighthouse-core/test/gather/computed/metrics/first-cpu-idle-test.js index 51464584791e..aafcb9daea3b 100644 --- a/lighthouse-core/test/gather/computed/metrics/first-cpu-idle-test.js +++ b/lighthouse-core/test/gather/computed/metrics/first-cpu-idle-test.js @@ -66,8 +66,8 @@ describe('FirstInteractive computed artifact:', () => { assert.equal(Math.round(result.timing), 5308); assert.equal(Math.round(result.optimisticEstimate.timeInMs), 2451); assert.equal(Math.round(result.pessimisticEstimate.timeInMs), 2752); - assert.equal(result.optimisticEstimate.nodeTiming.size, 19); - assert.equal(result.pessimisticEstimate.nodeTiming.size, 79); + assert.equal(result.optimisticEstimate.nodeTimings.size, 19); + assert.equal(result.pessimisticEstimate.nodeTimings.size, 79); assert.ok(result.optimisticGraph, 'should have created optimistic graph'); assert.ok(result.pessimisticGraph, 'should have created pessimistic graph'); }); diff --git a/lighthouse-core/test/gather/computed/metrics/first-meaningful-paint-test.js b/lighthouse-core/test/gather/computed/metrics/first-meaningful-paint-test.js index db4c384a655b..93a370951fdb 100644 --- a/lighthouse-core/test/gather/computed/metrics/first-meaningful-paint-test.js +++ b/lighthouse-core/test/gather/computed/metrics/first-meaningful-paint-test.js @@ -42,8 +42,8 @@ describe('Metrics: FMP', () => { assert.equal(Math.round(result.timing), 2851); assert.equal(Math.round(result.optimisticEstimate.timeInMs), 911); assert.equal(Math.round(result.pessimisticEstimate.timeInMs), 1198); - assert.equal(result.optimisticEstimate.nodeTiming.size, 4); - assert.equal(result.pessimisticEstimate.nodeTiming.size, 7); + assert.equal(result.optimisticEstimate.nodeTimings.size, 4); + assert.equal(result.pessimisticEstimate.nodeTimings.size, 7); assert.ok(result.optimisticGraph, 'should have created optimistic graph'); assert.ok(result.pessimisticGraph, 'should have created pessimistic graph'); }); diff --git a/lighthouse-core/test/gather/computed/metrics/lantern-consistently-interactive-test.js b/lighthouse-core/test/gather/computed/metrics/lantern-consistently-interactive-test.js index 99251c0c3fa9..81599d852373 100644 --- a/lighthouse-core/test/gather/computed/metrics/lantern-consistently-interactive-test.js +++ b/lighthouse-core/test/gather/computed/metrics/lantern-consistently-interactive-test.js @@ -20,8 +20,8 @@ describe('Metrics: Lantern TTCI', () => { assert.equal(Math.round(result.timing), 5308); assert.equal(Math.round(result.optimisticEstimate.timeInMs), 2451); assert.equal(Math.round(result.pessimisticEstimate.timeInMs), 2752); - assert.equal(result.optimisticEstimate.nodeTiming.size, 19); - assert.equal(result.pessimisticEstimate.nodeTiming.size, 79); + assert.equal(result.optimisticEstimate.nodeTimings.size, 19); + assert.equal(result.pessimisticEstimate.nodeTimings.size, 79); assert.ok(result.optimisticGraph, 'should have created optimistic graph'); assert.ok(result.pessimisticGraph, 'should have created pessimistic graph'); }); diff --git a/lighthouse-core/test/gather/computed/metrics/lantern-first-contentful-paint-test.js b/lighthouse-core/test/gather/computed/metrics/lantern-first-contentful-paint-test.js index 036bb64dfa3d..55e2121c0fe8 100644 --- a/lighthouse-core/test/gather/computed/metrics/lantern-first-contentful-paint-test.js +++ b/lighthouse-core/test/gather/computed/metrics/lantern-first-contentful-paint-test.js @@ -20,8 +20,8 @@ describe('Metrics: Lantern FCP', () => { assert.equal(Math.round(result.timing), 2038); assert.equal(Math.round(result.optimisticEstimate.timeInMs), 611); assert.equal(Math.round(result.pessimisticEstimate.timeInMs), 611); - assert.equal(result.optimisticEstimate.nodeTiming.size, 2); - assert.equal(result.pessimisticEstimate.nodeTiming.size, 2); + assert.equal(result.optimisticEstimate.nodeTimings.size, 2); + assert.equal(result.pessimisticEstimate.nodeTimings.size, 2); assert.ok(result.optimisticGraph, 'should have created optimistic graph'); assert.ok(result.pessimisticGraph, 'should have created pessimistic graph'); }); diff --git a/lighthouse-core/test/gather/computed/metrics/lantern-first-cpu-idle-test.js b/lighthouse-core/test/gather/computed/metrics/lantern-first-cpu-idle-test.js index b4b9e8519c26..2b2e900e7b5b 100644 --- a/lighthouse-core/test/gather/computed/metrics/lantern-first-cpu-idle-test.js +++ b/lighthouse-core/test/gather/computed/metrics/lantern-first-cpu-idle-test.js @@ -20,8 +20,8 @@ describe('Metrics: Lantern TTFCPUI', () => { assert.equal(Math.round(result.timing), 5308); assert.equal(Math.round(result.optimisticEstimate.timeInMs), 2451); assert.equal(Math.round(result.pessimisticEstimate.timeInMs), 2752); - assert.equal(result.optimisticEstimate.nodeTiming.size, 19); - assert.equal(result.pessimisticEstimate.nodeTiming.size, 79); + assert.equal(result.optimisticEstimate.nodeTimings.size, 19); + assert.equal(result.pessimisticEstimate.nodeTimings.size, 79); assert.ok(result.optimisticGraph, 'should have created optimistic graph'); assert.ok(result.pessimisticGraph, 'should have created pessimistic graph'); }); diff --git a/lighthouse-core/test/gather/computed/metrics/lantern-first-meaningful-paint-test.js b/lighthouse-core/test/gather/computed/metrics/lantern-first-meaningful-paint-test.js index 0f3a99a16dbc..71d5b7a2a711 100644 --- a/lighthouse-core/test/gather/computed/metrics/lantern-first-meaningful-paint-test.js +++ b/lighthouse-core/test/gather/computed/metrics/lantern-first-meaningful-paint-test.js @@ -20,8 +20,8 @@ describe('Metrics: Lantern FMP', () => { assert.equal(Math.round(result.timing), 2851); assert.equal(Math.round(result.optimisticEstimate.timeInMs), 911); assert.equal(Math.round(result.pessimisticEstimate.timeInMs), 1198); - assert.equal(result.optimisticEstimate.nodeTiming.size, 4); - assert.equal(result.pessimisticEstimate.nodeTiming.size, 7); + assert.equal(result.optimisticEstimate.nodeTimings.size, 4); + assert.equal(result.pessimisticEstimate.nodeTimings.size, 7); assert.ok(result.optimisticGraph, 'should have created optimistic graph'); assert.ok(result.pessimisticGraph, 'should have created pessimistic graph'); }); diff --git a/lighthouse-core/test/lib/dependency-graph/simulator/simulator-test.js b/lighthouse-core/test/lib/dependency-graph/simulator/simulator-test.js index 3c53b59f6e66..321def2419b7 100644 --- a/lighthouse-core/test/lib/dependency-graph/simulator/simulator-test.js +++ b/lighthouse-core/test/lib/dependency-graph/simulator/simulator-test.js @@ -40,7 +40,7 @@ describe('DependencyGraph/Simulator', () => { const serverResponseTimeByOrigin = new Map([['http://example.com', 500]]); function assertNodeTiming(result, node, assertions) { - const timing = result.nodeTiming.get(node); + const timing = result.nodeTimings.get(node); assert.ok(timing, 'missing node timing information'); Object.keys(assertions).forEach(key => { assert.equal(timing[key], assertions[key]); diff --git a/typings/gatherer.d.ts b/typings/gatherer.d.ts index 5a85ef483032..8f0d9c4599b2 100644 --- a/typings/gatherer.d.ts +++ b/typings/gatherer.d.ts @@ -61,7 +61,7 @@ declare global { export interface Result { timeInMs: number; - nodeTiming: Map; + nodeTimings: Map; } } }