Increase the nesting threshold before which setTimeout(..., <4ms) start being clamped, from 5 to 100. setTimeout(..., 0) is commonly used to break down long Javascript tasks and let other internal tasks run, which prevents the browser from hanging. setTimeouts and setIntervals with an interval < 4ms are not clamped as aggressively as they were before. This improves short horizon performance, but websites abusing the API will still eventually have their set setTimeouts clamped
setTimeout is a well established and mature API. This change poses a risk of breaking websites and tests that rely on the current timing caused by clamping and the subtle task ordering that it entails. As an example, this change breaks assumptions about the ordering between setTimeout(0) and unrelated tasks in at least one case in Chrome tests (crbug.com/1302309). On the flip side, the implementation in Chrome is already non compliant (crbug.com/1108877). There's also a similar experiment on beta that is ongoing (crbug.com/1263190). Devs can use chrome://flags#unthrottled-nested-timeout to test their sites for compatibility issues.
Does this intent deprecate or change behavior of existing APIs, such that it has potentially high risk for Android WebView-based applications?
Gain insight on potential compatibility issues and evaluate impact on guardian metrics (page load, latency).
None
setTimeout() and setInterval() have an associated trace event in DevTools. https://developer.chrome.com/docs/devtools/evaluate-performance/performance-reference/
OriginTrial desktop last | 102 |
OriginTrial desktop first | 101 |
DevTrial on desktop | 101 |
OriginTrial android last | 102 |
OriginTrial android first | 101 |
DevTrial on android | 101 |
What's the plan for finding sites this breaks? Monitor bug reports? Or is there something more proactive we could do?
Thanks!What's the plan for finding sites this breaks? Monitor bug reports? Or is there something more proactive we could do?I'm thinking about bug reports and guardian metrics. shaseley@ might have additional insight from running a similar experiment crbug.com/1263190
Hi all,
I'm sharing an update with results of the experiments over 21 days on Chrome Beta M102.
The results below are mostly small percentages changes, and the finch guidelines says to trust results on Stable. Given no issue have been raised AFAIK I would like to roll out a 1% finch experiment on Stable and I'm wondering what would be the required steps to do this (besides flipping boxes on the launch crbug.com/1298967) without amending what the spec says just yet.
The experiment MaxUnthrottledTimeoutNestingLevel has been running on canary/dev/beta M101 and M102.
Another experiment SetTimeoutZeroWithoutClamping which removes setTimeout(,0) clamping to 1 ms is running at Enabled(25%) and Default(50%) on Beta. Analyzing the results for both experiments together makes sense because our goal is to avoid delayed tasks for immediate setTimeout()s.
MaxUnthrottledTimeoutNestingLevel (50% enabled / 50% control) + SetTimeoutZeroWithoutClamping (Default + Enabled is 75%)
No impact on Guiding Metrics
-15.85% Time To Paint For Each Ad Frame @ 95%ile 2-diamonds
-1.78% First Input Delay @ 99%ile 1-diamonds
-0.74% Time to Largest Contentful Paint @ 99%ile 1-diamonds
-0.79% Cumulative Layout Shift @ 95%ile 2-diamonds
-1.45 / 1.26% Startup Time @ 95 / 99%ile 1 / 2-diamonds
+1.93% Scroll Latency Count 1-diamonds
+0.32% Memory: Renderer@ 50%ile 1-diamonds
MaxUnthrottledTimeoutNestingLevel ignoring SetTimeoutZeroWithoutClamping
Note: Results here are less interesting since our goal is to avoid delayed tasks for immediate setTimeout()s, which is only achieved under SetTimeoutZeroWithoutClamping.
+1.73% Time to First Contentful Paint @ 95%ile 2-diamonds
-1.28% Frame Drawing Interval @ 95%ile 1-diamonds
-1.44% Startup Time @ 99%ile 1-diamonds
Note: the downside of experimenting on Stable is that the intersection of both 1% experiments is very small and we probably won't be able to analyze results alongside before SetTimeoutZeroWithoutClamping ships (this should happen soon though).
Maybe a console warning message if we hit the nesting level that we plan to increase? I'm not sure how effective that would be in helping get folks to try it.
The change to the nesting level at which 4ms clamping kicks in (MaxUnthrottledTimeoutNestingLevel) never shipped, because Speedometer 2.1 is not affected by it like Speedometer 2.0 was. However, WebKit did implement this change: https://sourcegraph.com/github.com/WebKit/WebKit/-/commit/786e3e0b252e38fb01c8db97a94d52cb0f57891e and Chrome updated its documentation: https://github.com/GoogleChrome/developer.chrome.com/commit/b6529b1cc8fdd9b2cb3496f446ee332207ab40b2 even though it did not ship the change.What do Blink owners recommend as next step for this?
Did the experimentation show any positive or negative impact on real-life content?
Does the current spec match reality? (where this value is UA defined)
where does Gecko stand on this
If not, maybe that's the easiest way to provide clarity on this point, if WebKit is shipping one thing and Chromium does another.
Did the experimentation show any positive or negative impact on real-life content?
On windows, the only significant impact we saw in the field is a regression on Input Delay (Page Load), 5.20% at 95th %ile. No improvement otherwise, so I don't see any benefits of going forward with this anymore.
Does the current spec match reality? (where this value is UA defined)No. The spec seems to say "if > 5", Blink and Gecko do "if >= 4" which is off by 2 (crbug.com/1108877).WebKit used to do "if >= 5", but recently changed it to "if >= 10".where does Gecko stand on thisI tested this with the code snippet from crbug.com/1108877. This gives me the same result as Chrome.If not, maybe that's the easiest way to provide clarity on this point, if WebKit is shipping one thing and Chromium does another.Does this mean changing the spec to make it looser re. the threshold value?
const wait = _ => new Promise(resolve => setTimeout(resolve));for (many-operations) {doOperation();await wait();}
--
You received this message because you are subscribed to the Google Groups "blink-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to blink-dev+...@chromium.org.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/blink-dev/CAL5BFfWAZZbGjJpLAAc6C3ohZ4ChJZioPt1vG3wqBPxE5ViLZA%40mail.gmail.com.