Title: [292242] trunk
- Revision
- 292242
- Author
- [email protected]
- Date
- 2022-04-01 16:57:39 -0700 (Fri, 01 Apr 2022)
Log Message
Change one-shot maxTimerNestingLevel from 5 to 10
https://bugs.webkit.org/show_bug.cgi?id=237168
Reviewed by Sam Weinig, Saam Barati, and Cameron McCormack .
Source/WebCore:
Recently, we found from Chromium change[1] that changing this from 5 to 10 offers 10% Speedometer2 improvement
because Speedometer2's setTimeout nesting level is typically 7-8. We discussed with folks including Chris, Maciej,
Saam, and Cameron and for now, we increase this from 5 to 10 to align to Blink's change to keep these kind of web
content fast. This is not aligned to the spec, and currently, we only apply it to one-shot timer.
[1]: https://chromium-review.googlesource.com/c/chromium/src/+/3473463
* page/DOMTimer.cpp:
(WebCore::DOMTimer::intervalClampedToMinimum const):
(WebCore::DOMTimer::alignedFireTime const):
LayoutTests:
* fast/dom/timer-increase-min-interval.html:
* fast/dom/timer-throttling-hidden-page-expected.txt:
* fast/dom/timer-throttling-hidden-page.html:
Modified Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (292241 => 292242)
--- trunk/LayoutTests/ChangeLog 2022-04-01 23:35:37 UTC (rev 292241)
+++ trunk/LayoutTests/ChangeLog 2022-04-01 23:57:39 UTC (rev 292242)
@@ -1,3 +1,14 @@
+2022-04-01 Yusuke Suzuki <[email protected]>
+
+ Change one-shot maxTimerNestingLevel from 5 to 10
+ https://bugs.webkit.org/show_bug.cgi?id=237168
+
+ Reviewed by Sam Weinig, Saam Barati, and Cameron McCormack .
+
+ * fast/dom/timer-increase-min-interval.html:
+ * fast/dom/timer-throttling-hidden-page-expected.txt:
+ * fast/dom/timer-throttling-hidden-page.html:
+
2022-04-01 Jon Lee <[email protected]>
Unreviewed gardening.
Modified: trunk/LayoutTests/fast/dom/timer-increase-min-interval.html (292241 => 292242)
--- trunk/LayoutTests/fast/dom/timer-increase-min-interval.html 2022-04-01 23:35:37 UTC (rev 292241)
+++ trunk/LayoutTests/fast/dom/timer-increase-min-interval.html 2022-04-01 23:57:39 UTC (rev 292242)
@@ -17,7 +17,8 @@
function slowTimeoutHandler() {
// Note: the count threshold is tied somewhat to the
// maxTimerNestingLevel in DOMTimer.cpp.
- if (count < 10)
+ // Up to 10, we use 1ms, and after that, it becomes 500ms. So, it should be 12.
+ if (count < 12)
log("PASS");
else
log("FAIL -- timeout ran " + count + " times");
Modified: trunk/LayoutTests/fast/dom/timer-throttling-hidden-page-expected.txt (292241 => 292242)
--- trunk/LayoutTests/fast/dom/timer-throttling-hidden-page-expected.txt 2022-04-01 23:35:37 UTC (rev 292241)
+++ trunk/LayoutTests/fast/dom/timer-throttling-hidden-page-expected.txt 2022-04-01 23:57:39 UTC (rev 292242)
@@ -8,6 +8,11 @@
PASS internals.isTimerThrottled(timerHandle) is false
PASS internals.isTimerThrottled(timerHandle) is false
PASS internals.isTimerThrottled(timerHandle) is false
+PASS internals.isTimerThrottled(timerHandle) is false
+PASS internals.isTimerThrottled(timerHandle) is false
+PASS internals.isTimerThrottled(timerHandle) is false
+PASS internals.isTimerThrottled(timerHandle) is false
+PASS internals.isTimerThrottled(timerHandle) is false
PASS internals.isTimerThrottled(timerHandle) is true
PASS successfullyParsed is true
Modified: trunk/LayoutTests/fast/dom/timer-throttling-hidden-page.html (292241 => 292242)
--- trunk/LayoutTests/fast/dom/timer-throttling-hidden-page.html 2022-04-01 23:35:37 UTC (rev 292241)
+++ trunk/LayoutTests/fast/dom/timer-throttling-hidden-page.html 2022-04-01 23:57:39 UTC (rev 292242)
@@ -7,7 +7,7 @@
let timerCount = 0;
const timeoutInterval = 10;
- const maxNestingLevel = 5;
+ const maxNestingLevel = 10;
let timerHandle = 0;
function testTimer()
Modified: trunk/Source/WebCore/ChangeLog (292241 => 292242)
--- trunk/Source/WebCore/ChangeLog 2022-04-01 23:35:37 UTC (rev 292241)
+++ trunk/Source/WebCore/ChangeLog 2022-04-01 23:57:39 UTC (rev 292242)
@@ -1,3 +1,21 @@
+2022-04-01 Yusuke Suzuki <[email protected]>
+
+ Change one-shot maxTimerNestingLevel from 5 to 10
+ https://bugs.webkit.org/show_bug.cgi?id=237168
+
+ Reviewed by Sam Weinig, Saam Barati, and Cameron McCormack .
+
+ Recently, we found from Chromium change[1] that changing this from 5 to 10 offers 10% Speedometer2 improvement
+ because Speedometer2's setTimeout nesting level is typically 7-8. We discussed with folks including Chris, Maciej,
+ Saam, and Cameron and for now, we increase this from 5 to 10 to align to Blink's change to keep these kind of web
+ content fast. This is not aligned to the spec, and currently, we only apply it to one-shot timer.
+
+ [1]: https://chromium-review.googlesource.com/c/chromium/src/+/3473463
+
+ * page/DOMTimer.cpp:
+ (WebCore::DOMTimer::intervalClampedToMinimum const):
+ (WebCore::DOMTimer::alignedFireTime const):
+
2022-04-01 Ben Nham <[email protected]>
Add more push-related logging
Modified: trunk/Source/WebCore/page/DOMTimer.cpp (292241 => 292242)
--- trunk/Source/WebCore/page/DOMTimer.cpp 2022-04-01 23:35:37 UTC (rev 292241)
+++ trunk/Source/WebCore/page/DOMTimer.cpp 2022-04-01 23:57:39 UTC (rev 292242)
@@ -48,10 +48,12 @@
namespace WebCore {
-static const Seconds minIntervalForNonUserObservableChangeTimers { 1_s }; // Empirically determined to maximize battery life.
-static const Seconds minIntervalForOneShotTimers { 0_ms };
-static const Seconds minIntervalForRepeatingTimers { 1_ms };
-static const int maxTimerNestingLevel = 5;
+static constexpr Seconds minIntervalForNonUserObservableChangeTimers { 1_s }; // Empirically determined to maximize battery life.
+static constexpr Seconds minIntervalForOneShotTimers { 0_ms };
+static constexpr Seconds minIntervalForRepeatingTimers { 1_ms };
+static constexpr int maxTimerNestingLevel = 10;
+static constexpr int maxTimerNestingLevelForOneShotTimers = 10;
+static constexpr int maxTimerNestingLevelForRepeatingTimers = 5;
class DOMTimerFireState {
public:
@@ -393,7 +395,7 @@
Seconds interval = std::max(m_oneShot ? minIntervalForOneShotTimers : minIntervalForRepeatingTimers, m_originalInterval);
// Only apply throttling to repeating timers.
- if (m_nestingLevel < maxTimerNestingLevel)
+ if (m_nestingLevel < (m_oneShot ? maxTimerNestingLevelForOneShotTimers : maxTimerNestingLevelForRepeatingTimers))
return interval;
// Apply two throttles - the global (per Page) minimum, and also a per-timer throttle.
@@ -405,7 +407,7 @@
std::optional<MonotonicTime> DOMTimer::alignedFireTime(MonotonicTime fireTime) const
{
- Seconds alignmentInterval = scriptExecutionContext()->domTimerAlignmentInterval(m_nestingLevel >= maxTimerNestingLevel);
+ Seconds alignmentInterval = scriptExecutionContext()->domTimerAlignmentInterval(m_nestingLevel >= (m_oneShot ? maxTimerNestingLevelForOneShotTimers : maxTimerNestingLevelForRepeatingTimers));
if (!alignmentInterval)
return std::nullopt;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes