# Real performance data for Lighthouse

**URL:** <https://meta.discourse.org/t/real-performance-data-for-lighthouse/214920>\
**Category:** Development\
**Created:** [January 14, 2022, 11:38pm UTC](https://meta.discourse.org/t/real-performance-data-for-lighthouse/214920 "2022-01-14T23:38:38Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![rrit](https://avatars.discourse-cdn.com/v4/letter/r/b5ac83/32.png) [@rrit](https://meta.discourse.org/u/rrit)\
**Post date:** [January 14, 2022, 11:38pm UTC](https://meta.discourse.org/t/real-performance-data-for-lighthouse/214920/1 "2022-01-14T23:38:38Z")

</div>

Can we exclude the user-agent “Chrome-Lighthouse” from crawlers and thereby show Lighthouse the real application view?

[https://github.com/discourse/discourse/pull/15592](https://github.com/discourse/discourse/pull/15592)

### Application-view performance

This enables [Lightouse](https://github.com/GoogleChrome/lighthouse) in Chrome DevTools and [PageSpeed Insights](https://pagespeed.web.dev/) to measure the performance of Discourse like viewed by an user.

 ![lighthouse-performance-application-view](https://global.discourse-cdn.com/meta/original/3X/3/b/3bead65e4ed56a75ec842afef841c01d93e1d98e.png)

### Crawler-view performance

Until now Lighthouse measured the performance for an user-device which is rendering the crawler-layout - this never happens in reality.

 ![lighthouse-performance-crawler-view](https://global.discourse-cdn.com/meta/original/3X/9/0/9070057ccaa24d0d95ba87fd682799ff68acc715.png)

---

<div class="post-metadata">

**Author:** ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)\
**Post date:** [January 14, 2022, 11:51pm UTC](https://meta.discourse.org/t/real-performance-data-for-lighthouse/214920/2 "2022-01-14T23:51:58Z")

</div>

When they run those lighthose performance tests on a recent iPhone model (even an iPhone 8 or later), I am open to this. Right now android performance is 3x (or more) slower than iPhone unfortunately. 😔

Check your device at [Speedometer 2.0](https://browserbench.org/Speedometer2.0/) to see what I mean – this measures JavaScript performance in the browser:

 ![image](https://global.discourse-cdn.com/meta/original/3X/4/2/42f97295bf8a33d9230c4b170235ed2e3c94a8cc.jpeg)

Until they run lighthouse on an iPhone (any model) for context, I am absolutely opposed to any change here. When they do, I will happily accept the PR, with gusto.

---

<div class="post-metadata">

**Author:** ![rrit](https://avatars.discourse-cdn.com/v4/letter/r/b5ac83/32.png) [@rrit](https://meta.discourse.org/u/rrit)\
**Post date:** [January 14, 2022, 11:58pm UTC](https://meta.discourse.org/t/real-performance-data-for-lighthouse/214920/3 "2022-01-14T23:58:56Z")

</div>

For their metrics they are already collecting “real-user experience data” ([CrUX dataset](https://developers.google.com/speed/docs/insights/v5/about#crux)) from ~200 EUR/USD Android phones running Chrome - and this data gets into the [Core Web Vitals report](https://support.google.com/webmasters/answer/9205520) on [Google Search Console](https://search.google.com/search-console/core-web-vitals).

How about putting this behind a flag or enable it for development environments only?

---

<div class="post-metadata">

**Author:** ![Falco](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/falco/32/179432_2.png) [@Falco](https://meta.discourse.org/u/Falco)\
**Post date:** [January 15, 2022, 12:08am UTC](https://meta.discourse.org/t/real-performance-data-for-lighthouse/214920/4 "2022-01-15T00:08:14Z")

</div>

You can run lighthouse with a custom user agent from your machine to get the SPA perf numbers.

---

<div class="post-metadata">

**Author:** ![rrit](https://avatars.discourse-cdn.com/v4/letter/r/b5ac83/32.png) [@rrit](https://meta.discourse.org/u/rrit)\
**Post date:** [January 16, 2022, 3:10pm UTC](https://meta.discourse.org/t/real-performance-data-for-lighthouse/214920/5 "2022-01-16T15:10:52Z")

</div>

> [@Falco](#):
>
> run lighthouse with a custom user agent

For this solution to measure the intended Discourse view:

- mobile-view: add `?mobile_view=1` to the url
- desktop-view: add `?mobile_view=0` to the url

This setting is remembered in LocalStorage. So reset it once if necessary:  
Add `?mobile_view=auto` to the url.

> <https://github.com/discourse/discourse/blob/1472e47aae5bfdfb6fd9abfe89beb186c751f514/app/assets/javascripts/discourse/app/lib/mobile.js#L20-L34>
