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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Desktop performance score lower in CLI than when testing in the browser #430

Closed
amannn opened this issue Aug 27, 2020 · 9 comments · Fixed by #433
Closed

Desktop performance score lower in CLI than when testing in the browser #430

amannn opened this issue Aug 27, 2020 · 9 comments · Fixed by #433
Labels

Comments

@amannn
Copy link
Contributor

amannn commented Aug 27, 2020

I'm using @lhci/cli to test the desktop viewport of a web app I'm developing. I'm using the emulatedFormFactor: 'desktop' setting.

When running in lhci, I get this score:

Screenshot 2020-08-27 at 11 43 43

However when I run the test with the same exact URL in Chrome, I get this score:

Screenshot 2020-08-27 at 11 59 47

I have no idea what is causing this.

Note that the mobile performance score of the same website is 100 in lhci – exactly the same as in Google Chrome.

Do you have any pointers? The app is private, therefore I sadly can't share a reproduction at this point. Thank you for your help!

Versions:

  • @lhci/cli: 0.4.4 (although I got the same result when trying out 0.5.0)
  • Chrome: Version 84.0.4147.135 (Official Build) (64-bit)
  • OS: macOS 10.15.4 (19E287)
  • Chrome Lighthouse: 6.0.0
  • @lhci/cli Lighthouse: 6.0.0
@patrickhulce
Copy link
Collaborator

Thanks for filing @amannn!

When you're running from the CLI (like LHCI does) form factor and throttling are controlled separately unlike Chrome DevTools which handles this behind the scenes for you (see desktop throttling profile).

module.exports = {
  ci: {
    collect: {
      settings: {
        emulatedFormFactor: 'desktop',
        throttling: {rttMs: 40, throughputKbps: 10 * 1024, cpuSlowdownMultiplier: 1},
      }
  }
}

We'd welcome adding this example config to the docs if you're up for a PR :)

@amannn
Copy link
Contributor Author

amannn commented Aug 27, 2020

Oh, I see! Thanks for your quick reply – now this works as expected 🙂 .

Would it make sense for lighthouse-ci to include an option to set the device like lighthouse does it in the Chrome DevTools?

Screenshot 2020-08-27 at 17 17 51

The option would control both the form factor and the throttling.

@patrickhulce
Copy link
Collaborator

Would it make sense for lighthouse-ci to include an option to set the device like lighthouse does it in the Chrome DevTools?

We don't really want to drift from the official Lighthouse programmatic API. It's being considered over there for 7.0 if you want to chime in GoogleChrome/lighthouse#10910

@amannn
Copy link
Contributor Author

amannn commented Aug 27, 2020

Right, I see. I'll open a PR to add the desktop settings to the docs as you proposed above.

@ankityadav4
Copy link

ankityadav4 commented Apr 20, 2023

@patrickhulce I am trying Lighthouse CLI and facing similar issue with huge difference on Lighthouse UI and Lighthouse CLI.

I am running below command:
lighthouse --output html --output-path C:\0508.html --skip-audits bf-cache --preset=desktop --only-categories performance --throttling.rttMs 40 --throttling.throughputKbp 10240 --throttling.cpuSlowdownMultiplier 1

I am getting a differnece of at least 20-25 in Lh score.

What am i doing wrong?

@patrickhulce
Copy link
Collaborator

That's not really enough information to explain why. If you can share the full reports, we might be able to provide more assistance. (depending on metric values, 20-25 isn't that unexpected variance)

@ankityadav4
Copy link

@patrickhulce Please find the attached reports. Do you have any pointers?
Lighthouse Report.pdf
LighthouseReport-UI.pdf

@adamraine
Copy link
Member

@ankityadav4 as patrick said the variance you are experiencing is not unexpected. There are a variety of reasons that the performance score of a page could change between runs.

The page content is slightly different between the two reports, this could affect your performance score. Please read our variance docs for more help.

@adamraine
Copy link
Member

I'm going to lock this issue as it is very old. If you have a similar issue, please read our variance docs before filing a new issue.

@GoogleChrome GoogleChrome locked as resolved and limited conversation to collaborators May 8, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants