Skip to content

Set setStatus: null and monitorRunDependencies: null explicitly for w… #119

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

Merged
merged 1 commit into from
Aug 11, 2025

Conversation

Constellation
Copy link
Member

…asm tests

emscripten generates the following code,

  if (Module["setStatus"]) {
    Module["setStatus"]("Running...");
    setTimeout(() => {
      setTimeout(() => Module["setStatus"](""), 1);
      doRun();
    }, 1);
  } else {
    doRun();
  }

And this code is ran in the first iteration of wasm benchmarks since it includes setup code. This causes a problem since it has artificially inserted setTimeout with 1ms.

  1. It can insert 1ms wait time artificially. This is not so great since it reduces CPU pstate randomly, causing weird perf cliff depending on CPU's powner management instead of JS engine's quality.
  2. The spec requires setTimeout to have some throttling mechanism. So we can hit some artificial large delay more than 1ms based on how many nestings we did before (https://webkit.org/blog/13083/speedometer-2-1/)

This patch explicitly sets setStatus and monitorRunDependencies to null so that we will not use this setTimeout code path generated by emscripten. This is already done for SpiderMonkey shell. So we expand it for the other engines as well.

Close #118

@Constellation Constellation requested a review from kmiller68 August 8, 2025 21:45
Copy link

netlify bot commented Aug 8, 2025

Deploy Preview for webkit-jetstream-preview ready!

Name Link
🔨 Latest commit 1408ec2
🔍 Latest deploy log https://app.netlify.com/projects/webkit-jetstream-preview/deploys/689a3ac29bd1570008fe0991
😎 Deploy Preview https://deploy-preview-119--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 project configuration.

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.

LGTM, @danleh / @eqrion, thoughts?

Copy link
Contributor

@danleh danleh left a comment

Choose a reason for hiding this comment

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

LGTM, with tiny nit/simplifications. Nice find!

emscripten generates the following code,

```
  if (Module["setStatus"]) {
    Module["setStatus"]("Running...");
    setTimeout(() => {
      setTimeout(() => Module["setStatus"](""), 1);
      doRun();
    }, 1);
  } else {
    doRun();
  }
```

And this code is ran in the first iteration of wasm benchmarks since it
includes setup code. This causes a problem since it has artificially
inserted setTimeout with 1ms.

1. It can insert 1ms wait time artificially. This is not so great since
   it reduces CPU pstate randomly, causing weird perf cliff depending on
   CPU's powner management instead of JS engine's quality.
2. The spec requires setTimeout to have some throttling mechanism. So we
   can hit some artificial large delay more than 1ms based on how many
   nestings we did before (https://webkit.org/blog/13083/speedometer-2-1/)

This patch removes setStatus and monitorRunDependencies so that we will not
use this `setTimeout` code path generated by emscripten. This is already done
for SpiderMonkey shell. So we expand it for the other engines as well.

Close WebKit#118
@Constellation Constellation merged commit d65b1ab into WebKit:main Aug 11, 2025
10 checks passed
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.

First iteration of Wasm tests is accidentally including setTimeout times
3 participants