Skip to content
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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable CPU throttling (4.5x) #1778

Merged
merged 7 commits into from
Mar 14, 2017
Merged

Enable CPU throttling (4.5x) #1778

merged 7 commits into from
Mar 14, 2017

Conversation

addyosmani
Copy link
Member

This change enables CPU throttling by default and switches the slow-down from 5x -> 3.5x (as discussed with @paulirish in person). The 3.5x aligns closer with the CPU differences observed between a MBP and a Moto G4 (our current recommendation for 'average' mobile hardware).

screen shot 2017-02-25 at 12 13 46 am

If there are any further changes required to enable this, please feel free to 馃憢

@addyosmani
Copy link
Member Author

cc @wardpeet in case I'm missing anything.

@ebidel
Copy link
Contributor

ebidel commented Feb 25, 2017

@addyosmani how much closer does this take us to aligning with WPT results? Curious if you had time to run the same site against WPT and this PR?

Copy link
Member

@paulirish paulirish left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice. Thanks for this.

@@ -313,9 +313,8 @@ class GatherRunner {
return Promise.reject(new Error('You must provide a config'));
}

// CPU throttling is temporarily off by default
if (typeof options.flags.disableCpuThrottling === 'undefined') {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Afaik you can nuke this conditional

@@ -124,7 +124,7 @@ function onGenerateReportButtonClick(background, selectedAggregations) {

background.runLighthouseInExtension({
flags: {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can drop this flags object

@paulirish
Copy link
Member

Oh I think there's a note about mobile testing in the readme that can also use a tweak.

@addyosmani
Copy link
Member Author

@paulirish Woo. Thanks for the review! I'll get those three bits dropped shortly.

@ebidel Good questions :) The 3.5x number came from locally comparing traces seen on a Moto G4 over remote debugging vs LH on desktop. Talking to Pat this week, he seemed supportive of the change getting us 90% of the way there in the short term.

I'm going to run some more experiments as a sanity check and report back here.

@addyosmani
Copy link
Member Author

@paulirish relevant to the multiplier: do we have any UMA data on the type of desktop/hardware the average DevTools user is on? Just want a sanity check that the MBP is a fair baseline to assume.

@wardpeet
Copy link
Collaborator

wardpeet commented Feb 26, 2017

Looks nice 馃憤

I'm referring these #820 and #747 where we had a previous discussion.
still no one fan of calculating it with host cpu data?

@addyosmani
Copy link
Member Author

After trying to look at calibration for a while, I'm updating my recommendation to CPU throttling at 4.5x and tweaking that over time. @paulirish could you let me know if you'd be down with that and I'll update my PR?

Here are a few comparisons between WPT runs over a Moto G4 with 3G and DevTools using a 4.3-4.5x CPU throttling + custom network throttling closer to what WPT is doing:

Polymer Shop - closer with 4.5x CPU slowdown

image

ReactHN - closer with a 4.5x CPU throttling slowdown

image

Fashion United - close..ish with 4.5x CPU slowdown
image

Voice Memos with 4.5x

image

Code.gov with 4.3x CPU slowdown

image

Twitter.com (outlier) at 4x CPU (~1000ms slower)

image

@addyosmani addyosmani changed the title Enable CPU throttling (3.5x) Enable CPU throttling (4.5x) Mar 14, 2017
@addyosmani
Copy link
Member Author

@paulirish I believe I've addressed your feedback and rebased against master. PTAL whenever you get a chance.

Copy link
Member

@paulirish paulirish left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few changes i think.

We also discussed yesterday an easy mode for calibration. I think it went something like this:

  1. Expose the default multiplier via UI/CLI, etc.
  2. Communicate that you are uncalibrated
  3. Link to docs on doing a calibration
  4. That has a series of manual steps which could include running some npm module or whatever.
  5. It ends up giving you a new multiplier for your machine
  6. You enter that into the UI/CLI and the setting is persisted.

Anyway. we can head into this later. I'm happy to get the static multiplier in place now. :)

@@ -124,8 +124,7 @@ Example: --output-path=./lighthouse-results.html`,
// default values
.default('chrome-flags', '')
.default('disable-cpu-throttling', false)
.default('output', Printer.GetValidOutputOptions()[Printer.OutputMode.none])
.default('output-path', 'stdout')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i don't think you meant to change this, right?

@@ -124,8 +124,7 @@ Example: --output-path=./lighthouse-results.html`,
// default values
.default('chrome-flags', '')
.default('disable-cpu-throttling', false)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

false => true ?

@paulirish paulirish merged commit ade2d88 into master Mar 14, 2017
@paulirish paulirish deleted the cpu-throttling branch March 14, 2017 23:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants