harlan-zw / unlighthouse

Scan your entire site with Google Lighthouse in 2 minutes (on average). Open source, fully configurable with minimal setup.
https://unlighthouse.dev
MIT License
3.81k stars 110 forks source link

Performance in Desktop is way off #149

Closed mpn7 closed 7 months ago

mpn7 commented 1 year ago

Details

I'm building a website checker and I'm using unlighthouse for performance which makes my life much easier. But in testing multiple sites I've noticed that the desktop performance is always very off, most times gives me 100 score, but when I run the same site in Pagespeed Insights I get 70. I'm always expecting some difference but 30 points is a little off. In mobile it gets close, 55 in pagespeed and 65 in unlighthouse.

For mobile I use this settings:

unlighthouse-ci --site $url --output-path $outputPath/mobile --reporter jsonExpanded --mobile --no-cache --throttle

With the "--throttle" flag I get close enough reports.

But for desktop I've tried multiple things and can't get it to give me close values to Pagespeed insights. I use these settings in Desktop:

unlighthouse-ci --site $url --output-path $outputPath/desktop --reporter jsonExpanded --no-cache --config-file unlighthouse-desktop.config.ts

And in the unlighthouse-desktop.config.ts file:

const DESKTOP_EMULATION_METRICS = {
    mobile: false,
    width: 1350,
    height: 940,
    deviceScaleFactor: 1,
    disabled: false,
  };
export default {
    extends: 'lighthouse:default',
    lighthouseOptions: {
        formFactor: 'desktop',
        throttling: {
            rttMs: 40,
            throughputKbps: 10 * 1024,
            cpuSlowdownMultiplier: 1,
            requestLatencyMs: 0, // 0 means unset
            downloadThroughputKbps: 0,
            uploadThroughputKbps: 0,
        },
        screenEmulation: DESKTOP_EMULATION_METRICS,
        emulatedUserAgent:'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/109.0.0.0 Safari/537.36'
    }
}

I've pretty much copied the settings from lighthouse.

Does anyone know what can I do to get closer values to Pagespeed Insights?

pedddro commented 1 year ago

Zarlan is working on updating UNLH to LH v10; once he finishes, the results may match. using custom throttling. I assume the biggest difference is that Pagespeed is on LH v10, which gives CLS a 25% score, and deprecates TTI, which gives the scoring difference.

mpn7 commented 1 year ago

Do you have an ETA of that update?

slamer59 commented 11 months ago

@pedddro I experience the same results. The problem is that my page are getting higher results in v10. I will dig into the differences.