-
Notifications
You must be signed in to change notification settings - Fork 9.4k
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
core(image-elements): cache naturalSize results #9818
Conversation
how much faster tho |
25s to 1s on selfridges |
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.
great find! LGTM
Co-Authored-By: Patrick Hulce <patrick.hulce@gmail.com>
that doesn't seem possible, fwiw, or the protocol timeout is broken :) lighthouse/lighthouse-core/gather/gatherers/image-elements.js Lines 141 to 142 in 6d56a70
I get like 8s -> 250ms, which is still 👍 |
oh, I take it back. It's because they all share a network record so we just repeatedly fetch the same images 2000 times? Dear lord, yeah, good find. |
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.
LGTM2
This url is quite slow to run: https://www.selfridges.com/US/en/cat/womens/newin/
On the CLI, the ImageElements gatherer can take 25-30 seconds to run.
Turns out that gatherer finds ~2000 images, however 99% of them are country flag DOM elements with a css background using the exact same sprite image.
While we have added that smart only-do-the-50-most-important-network-images check... we don't handle the case of multiple background images pointing to the same asset that's within the top 50.
But now we do. :)