-
Notifications
You must be signed in to change notification settings - Fork 9.3k
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
perf: make network quiet threshold configurable per pass #2220
Conversation
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.
epic fix. nice work!
lighthouse-core/config/default.js
Outdated
@@ -29,6 +30,7 @@ module.exports = { | |||
{ | |||
"passName": "offlinePass", | |||
"useThrottling": false, | |||
"networkQuietThresholdMs": 500, |
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.
do we even need to wait 500 on these two passes?
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.
yeah probably not we really just need the main page, right?
wait, this was only 5000 because of #2023 :P It was 500 before |
This explains the end of trace ending up 10 seconds after most of the other metrics had completed, since we have the double 5 second wait. Can we eliminate one of
It doesn't seem like both are necessary. Arguably |
The answer is how much TTCI failure are we willing to tolerate? Most sites should be fine without pauseBeforeTraceEnd, but there are definite cases where it will fail. Maybe we make it optional? |
for the default
so we can just get rid of one and wait the sum of the current two, if we need that long |
It's not quite that simple, we can consolidate for sure but they serve different purposes. Increasing networkQuietThreshold to 10s might cause many more timeouts (it's not just waiting 5s at the end but up to 5s between each request) than the current approach, but adding 5s to pauseBeforeTraceEnd would also fail to capture network quiet periods more frequently than the current approach.
Given No matter what we can definitely skip pauseBeforeTraceEnd in the timeout case which is the current worst case scenario and shave off 5s. |
I think I see what you're saying. Basically we want five seconds of network quiet, but in theory the first few seconds of that window could contain a long task, so we need to wait longer? If I understand you correctly, there's not a ton of difference in waiting for seven seconds of network quiet. A single network request could go out after five seconds cancelling the network quiet detection but before the CPU quieted down, but with the current scheme three network requests going out after Basically this is all hand wavey and a post hoc justification and maybe that's what smells about it :) The fact that we don't have a way to observe the main thread is the primary issue with finding a good solution. If For now, how do you feel about renaming |
We should also consider (in the future) upping and we should add time to run lighthouse to plots/ cause we don't know what the average runtime is :) |
ya let's do it |
OK lots of new changes :) I've split the thresholds into 3 to accurately track what they're trying to do and moved it all into the page load
|
|
||
const _uniq = arr => Array.from(new Set(arr)); | ||
|
||
class Driver { | ||
static get MAX_WAIT_FOR_FULLY_LOADED() { | ||
return 25 * 1000; | ||
return 30 * 1000; |
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.
increased to account for the fact that the trace will end abruptly after this time instead of 5s after it, so we still aren't capturing any larger traces than 30s
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.
nice. i like the precision with the new options.
lighthouse-core/gather/driver.js
Outdated
@@ -25,13 +25,15 @@ const URL = require('../lib/url-shim'); | |||
const log = require('../lib/log.js'); | |||
const DevtoolsLog = require('./devtools-log'); | |||
|
|||
const PAUSE_AFTER_LOAD = 5000; | |||
const DEFAULT_PAUSE_AFTER_LOAD = 0; |
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.
can you add comments above these to explain what they are for? otherwise folks will have to backtrack to this discussion to totally understand. :)
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.
yup
in the name of OYB, shaves off ~9 seconds from all runs with the default passes
renames pauseAfterLoad to the more appropriate networkQuietThreshold, previously the flag was for speeding up the tests and was not documented in the CLI