-
Notifications
You must be signed in to change notification settings - Fork 6
Add commands to analyze URLs from HTTP Archive for Optimization Detective's effectiveness #178
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
Draft
westonruter
wants to merge
122
commits into
main
Choose a base branch
from
add/analyze-lcp-image-loading-prioritization
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
… into add/analyze-lcp-image-loading-prioritization
…yze URLs in parallel
… into add/analyze-lcp-image-loading-prioritization
… into add/analyze-lcp-image-loading-prioritization * 'main' of https://github.com/GoogleChromeLabs/wpp-research: Add missing predefined network conditions Add option to skip network priming Create new browser for each iteration and add pause-duration Update benchmark-web-vitals to launch new browser without cache for each request
… into add/analyze-lcp-image-loading-prioritization * 'main' of https://github.com/GoogleChromeLabs/wpp-research: Add broadband network conditions emulation
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.


Query HTTP Archive for the URLs of pages which have Image Prioritizer active (there are currently 17k+) using this sample BigQuery query. Output these URLs to a file
urls-with-image-prioritizer-on-2025-03-01.csv. A survey script in wpp-research will take each URL and load four versions in Puppeteer:Accessing pages with Optimization Detective disabled is achieved by adding
?optimization_detective_disabled=1, which is a feature of the plugin used for comparing optimized with non-optimized.Metrics for each page load are gathered and stored for later summarization.
To obtain the initial data, run the following command:
The results are output to the
output/image-prioritizer-2025-03-01subdirectory. There is a separate subdirectory created for each URL analyzed, with the directory name being an MD5 hash of the URL (with additional intermediary directories to avoid excessive directories). For example:The
optimizeddirectories contain the data for the page with Optimization Detective enabled, and theoriginaldirectories contain the data for when it is disabled. Theheaders.txtfiles contain the HTTP response headers and thecontent.htmlcontains the HTML response body. The metrics are located inresults.json, which looks like the following:{ "device": { "userAgent": "Mozilla/5.0 (Linux; Android 11; moto g power (2022)) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Mobile Safari/537.36", "viewport": { "isMobile": true, "width": 412, "height": 823, "isLandscape": false, "deviceScaleFactor": 1.75, "hasTouch": true } }, "metrics": { "TTFB": { "value": 136.39999997615814 }, "LCP": { "value": 240, "url": "http://localhost:8888/wp-content/uploads/2024/06/bison1-1024x668.jpg", "element": { "tagName": "DIV", "attributes": { "class": "wp-block-cover__image-background wp-image-13 size-large has-parallax", "style": "background-position:50% 50%;background-image:url(http://localhost:8888/wp-content/uploads/2024/06/bison1-1024x668.jpg)" }, "metaAttributes": { "xpath": "/HTML/BODY/DIV[@class='wp-site-blocks']/*[2][self::MAIN]/*[1][self::DIV]/*[3][self::DIV]/*[1][self::DIV]/*[2][self::DIV]" } }, "initiatorType": "link", "preloadedByOD": true }, "LCP-TTFB": { "value": 103.60000002384186 } }, "pluginVersions": { "optimization-detective": "optimization-detective 1.0.0-beta3", "image-prioritizer": "image-prioritizer 1.0.0-beta2" }, "odPreloadLinks": [ { "data-od-added-tag": "", "rel": "preload", "fetchpriority": "high", "as": "image", "href": "http://localhost:8888/wp-content/uploads/2024/06/bison1-1024x668.jpg", "media": "screen and (width <= 480px)" }, { "data-od-added-tag": "", "rel": "preload", "fetchpriority": "high", "as": "image", "href": "http://localhost:8888/wp-content/uploads/2024/06/bison1-1024x668.jpg", "media": "screen and (782px < width)" } ], "odTagsWithXpathAttrs": 1, "images": { "imgCount": 0, "lazyImgCount": 0, "lazyImgInsideViewportCount": 0, "jsLazyLoadedImgCount": 0, "fetchpriorityHighAttrImages": { "insideViewportCount": 0, "outsideViewportCount": 0 } } }Then to summarize the results, run the following command:
This will include pass/fail data for:
IMGand it hasfetchpriority=high. If the LCP element has an image but it is abackground-image, then this is always considered a failure since WordPress Core does not currently prioritize loading background images.IMGorbackground-image).IMGin the initial viewport.IMGwithfetchpriority=highoutside the viewport.It also will also report the diffs for the TTFB, LCP, and LCP-TTFB metrics between the original and optimized versions of the pages as both the average and median of all values.