Skip to content

Commit

Permalink
feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
patrickhulce committed Jul 19, 2017
1 parent f0909fc commit 93bed77
Show file tree
Hide file tree
Showing 8 changed files with 15 additions and 10 deletions.
7 changes: 4 additions & 3 deletions lighthouse-core/audits/audit.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,16 @@ class Audit {
}

/**
* Computes and clamps the score between 0 and 100 based on the measured value, and the two control
* points on the log-normal distribution (point of diminishing returns and the median value).
* Computes a clamped score between 0 and 100 based on the measured value. Score is determined by
* considering a log-normal distribution governed by the two control points, point of diminishing
* returns and the median value, and returning the percentage of sites that have higher value.
*
* @param {number} measuredValue
* @param {number} diminishingReturnsValue
* @param {number} medianValue
* @return {number}
*/
static computeScore(measuredValue, diminishingReturnsValue, medianValue) {
static computeLogNormalScore(measuredValue, diminishingReturnsValue, medianValue) {
const distribution = statistics.getLogNormalDistribution(
medianValue,
diminishingReturnsValue
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ class TotalByteWeight extends ByteEfficiencyAudit {
// <= 1600KB: score≈100
// 4000KB: score=50
// >= 9000KB: score≈0
const score = ByteEfficiencyAudit.computeScore(
const score = ByteEfficiencyAudit.computeLogNormalScore(
totalBytes,
SCORING_POINT_OF_DIMINISHING_RETURNS,
SCORING_MEDIAN
Expand Down
6 changes: 5 additions & 1 deletion lighthouse-core/audits/consistently-interactive.js
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,11 @@ class ConsistentlyInteractiveMetric extends Audit {
const extendedInfo = Object.assign(quietPeriodInfo, {timestamp, timeInMs});

return {
score: Audit.computeScore(timeInMs, SCORING_POINT_OF_DIMINISHING_RETURNS, SCORING_MEDIAN),
score: Audit.computeLogNormalScore(
timeInMs,
SCORING_POINT_OF_DIMINISHING_RETURNS,
SCORING_MEDIAN
),
rawValue: timeInMs,
displayValue: Util.formatMilliseconds(timeInMs),
optimalValue: this.meta.optimalValue,
Expand Down
2 changes: 1 addition & 1 deletion lighthouse-core/audits/dobetterweb/dom-size.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ class DOMSize extends Audit {
// <= 1500: score≈100
// 3000: score=50
// >= 5970: score≈0
const score = Audit.computeScore(
const score = Audit.computeLogNormalScore(
stats.totalDOMNodes,
SCORING_POINT_OF_DIMINISHING_RETURNS,
SCORING_MEDIAN
Expand Down
2 changes: 1 addition & 1 deletion lighthouse-core/audits/estimated-input-latency.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ class EstimatedInputLatency extends Audit {
// Median = 100ms
// 75th Percentile ≈ 133ms
// 95th Percentile ≈ 199ms
const score = Audit.computeScore(
const score = Audit.computeLogNormalScore(
ninetieth.time,
SCORING_POINT_OF_DIMINISHING_RETURNS,
SCORING_MEDIAN
Expand Down
2 changes: 1 addition & 1 deletion lighthouse-core/audits/first-interactive.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class FirstInteractiveMetric extends Audit {
return artifacts.requestFirstInteractive(trace)
.then(firstInteractive => {
return {
score: Audit.computeScore(
score: Audit.computeLogNormalScore(
firstInteractive.timeInMs,
SCORING_POINT_OF_DIMINISHING_RETURNS,
SCORING_MEDIAN
Expand Down
2 changes: 1 addition & 1 deletion lighthouse-core/audits/first-meaningful-paint.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ class FirstMeaningfulPaint extends Audit {
// 4000ms: score=50
// >= 14000ms: score≈0
const firstMeaningfulPaint = traceOfTab.timings.firstMeaningfulPaint;
const score = Audit.computeScore(
const score = Audit.computeLogNormalScore(
firstMeaningfulPaint,
SCORING_POINT_OF_DIMINISHING_RETURNS,
SCORING_MEDIAN
Expand Down
2 changes: 1 addition & 1 deletion lighthouse-core/audits/speed-index-metric.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ class SpeedIndexMetric extends Audit {
// Median = 5,500
// 75th Percentile = 8,820
// 95th Percentile = 17,400
const score = Audit.computeScore(
const score = Audit.computeLogNormalScore(
speedline.perceptualSpeedIndex,
SCORING_POINT_OF_DIMINISHING_RETURNS,
SCORING_MEDIAN
Expand Down

0 comments on commit 93bed77

Please sign in to comment.