Summary: | Not clamp setTimeout(..., 0) to 1ms | ||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Product: | WebKit | Reporter: | Wanming Lin <wanming.lin> | ||||||||||||||||||
Component: | DOM | Assignee: | Cameron McCormack (:heycam) <heycam> | ||||||||||||||||||
Status: | RESOLVED FIXED | ||||||||||||||||||||
Severity: | Normal | CC: | ap, cdumez, clopez, commit-queue, dean_johnson, esprehn+autocc, ews-watchlist, fpizlo, ggaren, heycam, kangil.han, mjs, rniwa, saam, sam, simon.fraser, webkit-bug-importer, youennf, ysuzuki | ||||||||||||||||||
Priority: | P2 | Keywords: | InRadar | ||||||||||||||||||
Version: | WebKit Nightly Build | ||||||||||||||||||||
Hardware: | Unspecified | ||||||||||||||||||||
OS: | Unspecified | ||||||||||||||||||||
See Also: | https://bugs.webkit.org/show_bug.cgi?id=253423 | ||||||||||||||||||||
Bug Depends on: | 215271, 238098 | ||||||||||||||||||||
Bug Blocks: | |||||||||||||||||||||
Attachments: |
|
Description
Wanming Lin
2021-01-29 00:23:43 PST
What is the motivation for changing the behavior, as opposed to correcting the spec? Seems like only bad things can possibly happen with regards to battery life; and there are other reasons why timers would be clamped anyway (nesters timers, backgrounds tabs). If this is desired to correct ordering, there are other ways to do it, but also unsure if it's a particularly likely case to run into. Thanks Alexey! One more motivation of this change is performance impact, we can see about 1% beneficial to Speedometer 2 on MiniBrowser on M1 with this change. As far as we've tested, there were no improvements on Intel Macs. Removing the 1ms setTimeout minimum, and leaving the existing nested throttling behavior, currently shows a 1.7% improvement on Speedometer locally for me, on an M1 MacBook Air. And 1.2% on my Intel MBP. Created attachment 454760 [details]
Patch
This patch modifies the imported WPT tests. Please ensure that any changes on the tests (not coming from a WPT import) are exported to WPT. Please see https://trac.webkit.org/wiki/WPTExportProcess Created attachment 455027 [details]
Patch
Committed r291476 (248592@main): <https://commits.webkit.org/248592@main> All reviewed patches have been landed. Closing bug and clearing flags on attachment 455027 [details]. Re-opened since this is blocked by bug 238098 I shouldn't have cq+ed this last night. Thinking about that test failure more this morning, I'm wondering if setTimeout(..., 0) callbacks are preempting whatever else is in the event queue. The HTML spec says that when the timeout fires, it should post a task to the event queue to run the timeout callback. Created attachment 455210 [details]
Patch v2
Created attachment 455212 [details]
Patch v2.1
Created attachment 455550 [details]
Patch
Created attachment 455868 [details]
Patch
Created attachment 455880 [details]
Patch
Created attachment 455881 [details]
Patch
Committed r291998 (248952@main): <https://commits.webkit.org/248952@main> All reviewed patches have been landed. Closing bug and clearing flags on attachment 455881 [details]. |