Skip to content

Configurable resource prefetching #70

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

camillobruni
Copy link
Contributor

This addresses issue #58 and is useful for local profiling.

If the prefetchResources is disabled, we now no longer preload them eagerly, but rather use the live URL and either script-inject it or use it directly with workers.
This means we can easily get the original source positions for profiling.

  • --no-prefetch command ilne support
  • &prefetchResources=0 URLParam support

Drive-by-fix:

  • Move FileLoader out of the IIFE

--no-prefetch will directly use `load(...)` instead of
just injecting the script sources which makes it easier to navigate
and investigate profiles.

- Support more complex command line args and flags
- Add --help to cli.js

Bug: 411303884
Change-Id: I43a032342a6da42bfb61ebd9415e62f9d9597ecc
Reviewed-on: https://chromium-review.googlesource.com/c/external/github.com/WebKit/JetStream/+/6468518
Reviewed-by: Leszek Swirski <leszeks@chromium.org>
Reviewed-by: Marja Hölttä <marja@chromium.org>
Copy link

netlify bot commented Apr 23, 2025

Deploy Preview for webkit-jetstream-preview ready!

Name Link
🔨 Latest commit 1f4b223
🔍 Latest deploy log https://app.netlify.com/sites/webkit-jetstream-preview/deploys/68092ff5729592000834b60f
😎 Deploy Preview https://deploy-preview-70--webkit-jetstream-preview.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@camillobruni camillobruni changed the title 2025 04 23 prefetch option Make resource prefetching optional Apr 23, 2025
@camillobruni camillobruni changed the title Make resource prefetching optional Configurable resource prefetching Apr 23, 2025
Copy link
Contributor

@kmiller68 kmiller68 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall seems fine. A couple comments though.

for (const test of testPlans)
print(" ", test.name)
} else {
print("Running tests: " + testList)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we not print this? I often run the cli with jsc -e 'dumpJSONResults = true' cli.js > results.json and this print would break that.

Comment on lines +812 to +815
if (globalThis.prefetchResources)
addScriptWithURL(cache[file].blobURL);
else
addScriptWithURL(file);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: I would just make this addScriptWithURL(globalThis.prefetchResources ? cache[file].blobURL : file);

@@ -23,25 +23,47 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/

globalThis.prefetchResources = true;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems unneeded.

@@ -36,7 +36,9 @@
const isInBrowser = true;
const isD8 = false;
const isSpiderMonkey = false;
globalThis.prefetchResources = true;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ditto on unneeded.

@@ -62,8 +70,12 @@ if (typeof(URLSearchParams) !== "undefined") {
customTestList = urlParameters.getAll("test");
globalThis.testIterationCount = getIntParam(urlParameters, "iterationCount");
globalThis.testWorstCaseCount = getIntParam(urlParameters, "worstCaseCount");
globalThis.prefetchResources = getBoolParam(urlParameters, "prefetchResources", true);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would pass globalThis.prefetchResources as the default value rather than true. Seems less likely to cause unexpected behavior if someone manually edits a different part of the script.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants