-
Notifications
You must be signed in to change notification settings - Fork 9.4k
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(speedindex): scale coefficients according to throttling #7007
Conversation
7ec56a0
to
e5ce2e3
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Just some ideas for the comments
@@ -42,6 +42,19 @@ class LanternMetricArtifact { | |||
throw new Error('COEFFICIENTS unimplemented!'); | |||
} | |||
|
|||
/** | |||
* Scale the coefficients according to the throttling settings. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe "Returns the coefficients, scaled by the throttling settings if needed by the metric. Some lantern metrics..." (or something like that) since this is more or less the proper way to retrieve this.COEFFICIENTS
now?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 sg
"pessimistic": 1631, | ||
"timing": 1657, | ||
} | ||
`); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lol
static scaleCoefficients(rttMs) { // eslint-disable-line no-unused-vars | ||
// We want to multiply our default coefficients based on how much farther from baseline our | ||
// new throttling settings are compared to the defaults. | ||
// We will use a baseline of 30 ms RTT (where Speed Index should be a ~50/50 blend of optimistic/pessimistic). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this description is a little confusing. One attempt at rewording: We want to scale our default coefficients based on the speed of the connection. We will linearly interpolate coefficients for the passed-in
rttMs based on the baseline points of 30 ms RTT (where Speed Index should be a ~50/50 blend of optimistic/pessimistic) and the default throttled RTT (where Speed Index should be the default-coefficient blend of optimistic/pessimistic).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also can you add a note about how this scale was derived/can be re-derived if defaults change in the future? It's not clear why you'd expect 50/50 mix at 30ms and then be what you'd expect between there and the default point and beyond :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done!!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
❤️ it
Summary
This PR makes it possible to scale the lantern coefficients based on the throttling settings. Previously the desktop LR preset was giving too pessimistic estimates on Speed Index because of the hardcoded
1.4x
multiplier on the observed speed index.Key Example Fix (facebook.com)
Before
After
Related Issues/PRs
fixes #6971