Skip to content

Commit

Permalink
update lantern metrics
Browse files Browse the repository at this point in the history
  • Loading branch information
patrickhulce committed May 8, 2018
1 parent de1d458 commit 2aab307
Show file tree
Hide file tree
Showing 16 changed files with 32 additions and 30 deletions.
6 changes: 4 additions & 2 deletions lighthouse-core/gather/computed/metrics/lantern-metric.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,11 +82,13 @@ class LanternMetricArtifact extends ComputedArtifact {
const optimisticGraph = this.getOptimisticGraph(graph, traceOfTab);
const pessimisticGraph = this.getPessimisticGraph(graph, traceOfTab);

const optimisticSimulation = simulator.simulate(optimisticGraph, {flexibleOrdering: true});
const optimisticSimulation = simulator.simulate(optimisticGraph);
const optimisticFlexSimulation = simulator.simulate(optimisticGraph, {flexibleOrdering: true});
const pessimisticSimulation = simulator.simulate(pessimisticGraph);

const optimisticEstimate = this.getEstimateFromSimulation(
optimisticSimulation,
optimisticSimulation.timeInMs < optimisticFlexSimulation.timeInMs ?
optimisticSimulation : optimisticFlexSimulation,
Object.assign({}, extras, {optimistic: true})
);

Expand Down
6 changes: 3 additions & 3 deletions lighthouse-core/test/audits/first-meaningful-paint-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ describe('Performance: first-meaningful-paint audit', () => {
const context = {options, settings: {throttlingMethod: 'simulate'}};
const fmpResult = await FMPAudit.audit(artifacts, context);

assert.equal(fmpResult.score, 0.92);
assert.equal(Util.formatDisplayValue(fmpResult.displayValue), '2,850\xa0ms');
assert.equal(Math.round(fmpResult.rawValue), 2851);
assert.equal(fmpResult.score, 0.95);
assert.equal(Util.formatDisplayValue(fmpResult.displayValue), '2,030\xa0ms');
assert.equal(Math.round(fmpResult.rawValue), 2029);
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,6 @@ describe('PWA: load-fast-enough-for-pwa audit', () => {

const settings = {throttlingMethod: 'provided', throttling: {rttMs: 40, throughput: 100000}};
const result = await FastPWAAudit.audit(artifacts, {settings});
assert.equal(Math.round(result.rawValue), 5308);
assert.equal(Math.round(result.rawValue), 4309);
});
});
10 changes: 5 additions & 5 deletions lighthouse-core/test/audits/metrics-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,15 @@ describe('Performance: metrics', () => {
const result = await Audit.audit(artifacts, {settings});

assert.deepStrictEqual(result.details.items[0], {
firstContentfulPaint: 2038,
firstContentfulPaint: 1272,
firstContentfulPaintTs: undefined,
firstMeaningfulPaint: 2851,
firstMeaningfulPaint: 2029,
firstMeaningfulPaintTs: undefined,
firstCPUIdle: 5308,
firstCPUIdle: 4309,
firstCPUIdleTs: undefined,
interactive: 5308,
interactive: 4309,
interactiveTs: undefined,
speedIndex: 2063,
speedIndex: 1501,
speedIndexTs: undefined,
estimatedInputLatency: 104,
estimatedInputLatencyTs: undefined,
Expand Down
12 changes: 6 additions & 6 deletions lighthouse-core/test/audits/predictive-perf-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,18 +25,18 @@ describe('Performance: predictive performance audit', () => {
}, Runner.instantiateComputedArtifacts());

return PredictivePerf.audit(artifacts).then(output => {
assert.equal(output.score, 0.79);
assert.equal(Math.round(output.rawValue), 5308);
assert.equal(output.displayValue, '5,310\xa0ms');
assert.equal(output.score, 0.86);
assert.equal(Math.round(output.rawValue), 4309);
assert.equal(output.displayValue, '4,310\xa0ms');

const valueOf = name => Math.round(output.extendedInfo.value[name]);
assert.equal(valueOf('roughEstimateOfFCP'), 2038);
assert.equal(valueOf('roughEstimateOfFCP'), 1272);
assert.equal(valueOf('optimisticFCP'), 611);
assert.equal(valueOf('pessimisticFCP'), 611);
assert.equal(valueOf('roughEstimateOfFMP'), 2851);
assert.equal(valueOf('roughEstimateOfFMP'), 2029);
assert.equal(valueOf('optimisticFMP'), 911);
assert.equal(valueOf('pessimisticFMP'), 1198);
assert.equal(valueOf('roughEstimateOfTTI'), 5308);
assert.equal(valueOf('roughEstimateOfTTI'), 4309);
assert.equal(valueOf('optimisticTTI'), 2451);
assert.equal(valueOf('pessimisticTTI'), 2752);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ describe('Metrics: FCP', () => {
const settings = {throttlingMethod: 'simulate'};
const result = await artifacts.requestFirstContentfulPaint({trace, devtoolsLog, settings});

assert.equal(Math.round(result.timing), 2038);
assert.equal(Math.round(result.timing), 1272);
assert.equal(Math.round(result.optimisticEstimate.timeInMs), 611);
assert.equal(Math.round(result.pessimisticEstimate.timeInMs), 611);
assert.equal(result.optimisticEstimate.nodeTimings.size, 2);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ describe('FirstInteractive computed artifact:', () => {
const artifacts = Runner.instantiateComputedArtifacts();
const result = await artifacts.requestFirstCPUIdle({trace, devtoolsLog, settings});

assert.equal(Math.round(result.timing), 5308);
assert.equal(Math.round(result.timing), 4309);
assert.equal(Math.round(result.optimisticEstimate.timeInMs), 2451);
assert.equal(Math.round(result.pessimisticEstimate.timeInMs), 2752);
assert.equal(result.optimisticEstimate.nodeTimings.size, 19);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ describe('Metrics: FMP', () => {

const result = await artifacts.requestFirstMeaningfulPaint({trace, devtoolsLog, settings});

assert.equal(Math.round(result.timing), 2851);
assert.equal(Math.round(result.timing), 2029);
assert.equal(Math.round(result.optimisticEstimate.timeInMs), 911);
assert.equal(Math.round(result.pessimisticEstimate.timeInMs), 1198);
assert.equal(result.optimisticEstimate.nodeTimings.size, 4);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ describe('Metrics: TTI', () => {
const settings = {throttlingMethod: 'simulate'};
const result = await artifacts.requestInteractive({trace, devtoolsLog, settings});

assert.equal(Math.round(result.timing), 5308);
assert.equal(Math.round(result.timing), 4309);
assert.equal(Math.round(result.optimisticEstimate.timeInMs), 2451);
assert.equal(Math.round(result.pessimisticEstimate.timeInMs), 2752);
assert.equal(result.optimisticEstimate.nodeTimings.size, 19);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ describe('Metrics: Lantern FCP', () => {
const result = await artifacts.requestLanternFirstContentfulPaint({trace, devtoolsLog,
settings: {}});

assert.equal(Math.round(result.timing), 2038);
assert.equal(Math.round(result.timing), 1272);
assert.equal(Math.round(result.optimisticEstimate.timeInMs), 611);
assert.equal(Math.round(result.pessimisticEstimate.timeInMs), 611);
assert.equal(result.optimisticEstimate.nodeTimings.size, 2);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ describe('Metrics: Lantern TTFCPUI', () => {
const artifacts = Runner.instantiateComputedArtifacts();
const result = await artifacts.requestLanternFirstCPUIdle({trace, devtoolsLog, settings: {}});

assert.equal(Math.round(result.timing), 5308);
assert.equal(Math.round(result.timing), 4309);
assert.equal(Math.round(result.optimisticEstimate.timeInMs), 2451);
assert.equal(Math.round(result.pessimisticEstimate.timeInMs), 2752);
assert.equal(result.optimisticEstimate.nodeTimings.size, 19);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ describe('Metrics: Lantern FMP', () => {
const result = await artifacts.requestLanternFirstMeaningfulPaint({trace, devtoolsLog,
settings: {}});

assert.equal(Math.round(result.timing), 2851);
assert.equal(Math.round(result.timing), 2029);
assert.equal(Math.round(result.optimisticEstimate.timeInMs), 911);
assert.equal(Math.round(result.pessimisticEstimate.timeInMs), 1198);
assert.equal(result.optimisticEstimate.nodeTimings.size, 4);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ describe('Metrics: Lantern TTI', () => {
const result = await artifacts.requestLanternInteractive({trace, devtoolsLog,
settings: {}});

assert.equal(Math.round(result.timing), 5308);
assert.equal(Math.round(result.timing), 4309);
assert.equal(Math.round(result.optimisticEstimate.timeInMs), 2451);
assert.equal(Math.round(result.pessimisticEstimate.timeInMs), 2752);
assert.equal(result.optimisticEstimate.nodeTimings.size, 19);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ describe('Metrics: Lantern Speed Index', () => {
const artifacts = Runner.instantiateComputedArtifacts();
const result = await artifacts.requestLanternSpeedIndex({trace, devtoolsLog, settings: {}});

assert.equal(Math.round(result.timing), 2063);
assert.equal(Math.round(result.timing), 1501);
assert.equal(Math.round(result.optimisticEstimate.timeInMs), 605);
assert.equal(Math.round(result.pessimisticEstimate.timeInMs), 2038);
assert.equal(Math.round(result.pessimisticEstimate.timeInMs), 1392);
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ describe('Metrics: Speed Index', () => {
const settings = {throttlingMethod: 'simulate'};
const result = await artifacts.requestSpeedIndex({trace, devtoolsLog, settings});

assert.equal(Math.round(result.timing), 2063);
assert.equal(Math.round(result.timing), 1501);
assert.equal(Math.round(result.optimisticEstimate.timeInMs), 605);
assert.equal(Math.round(result.pessimisticEstimate.timeInMs), 2038);
assert.equal(Math.round(result.pessimisticEstimate.timeInMs), 1392);
});

it('should compute an observed value', async () => {
Expand Down
2 changes: 1 addition & 1 deletion lighthouse-core/test/results/sample_v2.json
Original file line number Diff line number Diff line change
Expand Up @@ -2735,7 +2735,7 @@
{
"url": "http://localhost:10200/dobetterweb/dbw_partial_a.html?delay=200",
"totalBytes": 736,
"wastedMs": 723
"wastedMs": 873
},
{
"url": "http://localhost:10200/dobetterweb/dbw_tester.js",
Expand Down

0 comments on commit 2aab307

Please sign in to comment.