-
Notifications
You must be signed in to change notification settings - Fork 5
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
Introduce emulation of CPU throttling to benchmark-web-vitals #59
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.
Thanks @westonruter, code-wise this looks good to me, I also like the idea of a dedicated function to handle the arguments.
The numbers you gathered above are really interesting, it suggests the relative improvement gets lower the "slower" the CPU is? I think it would be great to expand on that in a post or doc or even dedicated GitHub issue, e.g. also summarizing how CPU throttling affects the other metrics, like LCP and TTFB individually. And then also what do the absolute differences look like? Is that more consistent between different throttling "levels"?
Interestingly, our recent 6.3 RC1 benchmarking results from different contributors show something different, where e.g. my benchmarks, which overall were slower than those of @swissspidy, still showed a greater relative improvement. Of course that may be influenced by lots of other factors, so it can't necessarily be taken as "source of truth".
Code-wise the PR is good to go, but it would be useful to write up a broader summary of this analysis so that we can share it as a reference point on the effects of how slower / throttled CPU can affect the benchmarks that we are running.
I've re-checked the results after updating to the latest Puppeteer and enabling the new headless mode from #61, and I got results that are more expected. I made a wrapper script that facilitates gathering the results, including a 5-second sleep between calls to
|
Site | 1x LCP | 4x LCP | 4x Diff | 6x LCP | 6x Diff |
---|---|---|---|---|---|
WP 6.2 | 54.0 | 202.5 | 375.0% | 301.3 | 557.9% |
WP 6.3 | 37.2 | 116.8 | 314.3% | 199.4 | 536.7% |
Introduces a new
-t
/--throttle-cpu
option to thebenchmark-web-vitals
command that allows you to supply a factor for emulating CPU throttling. This factor argument is passed to Puppeteer'sPage.emulateCPUThrottling()
API.Cheers to @swissspidy for alerting me to the Puppeteer API for this.
This PR also improves parsing of command line options into parameters, enduring strict typing.
I was surprised to find that increasing the throttling results in a reduction in the savings of LCP-TTFB in v6.3-RC2 vs v6.2.
WordPress 6.2 vs 6.3-RC2 without CPU Throttling
WordPress 6.2:
WordPress 6.3-RC2:
👉 48% reduction in LCP-TTFB
WordPress 6.2 vs 6.3-RC2 with 4x CPU Throttling
WordPress 6.2:
WordPress 6.3-RC2:
👉 42% reduction in LCP-TTFB
WordPress 6.2 vs 6.3-RC2 with 8x CPU Throttling
WordPress 6.2:
WordPress 6.3-RC2:
👉 27% reduction in LCP-TTFB