Bug 272156 - setInterval average delay is larger than expected when it runs in Low Power Mode or in iframe
Summary: setInterval average delay is larger than expected when it runs in Low Power M...
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebCore Misc. (show other bugs)
Version: Safari 17
Hardware: iPhone / iPad iOS 17
: P2 Normal
Assignee: Nobody
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2024-04-04 07:23 PDT by Fuwei Chin
Modified: 2024-04-11 07:24 PDT (History)
3 users (show)

See Also:


Attachments
setInterval test results for various platforms/browsers and conditions/modes (31.47 KB, image/png)
2024-04-04 07:23 PDT, Fuwei Chin
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Fuwei Chin 2024-04-04 07:23:36 PDT
Created attachment 470754 [details]
setInterval test results for various platforms/browsers and conditions/modes

For global function setInterval, the average delay detected may be 30% larger than the delay parameter value when Lower Power Mode is turned on or script runs in iframe. e.g. `setInterval(()=>{}, 66.66666666666667)` may actually scheduled at interval delay of 89ms.

For average delay of setInterval implementations, I must adimit mobile Safari can make it very accurate in normal conditions, since Chrome just ignores fractional part of the delay parameter, and desktop Firefox has no self-regulation to ensure an accurate average delay.

See demo [setInterval actual interval test](https://codepen.io/fuweichin/pen/PoayPbm) and attachment [setInterval test results for various platforms/browsers and conditions/modes].
Comment 1 Radar WebKit Bug Importer 2024-04-11 07:24:12 PDT
<rdar://problem/126273114>