Open Bug 1379178 Opened 9 years ago Updated 4 years ago

requestIdleCallback() reports less idle time when there is no rendering happening

Categories

(Core :: DOM: Core & HTML, defect, P3)

defect

Tracking

()

People

(Reporter: bkelly, Unassigned)

Details

STR: 1. Open https://idle-no-render.glitch.me/ in a fresh browser instance 2. Observe that firefox executes around 15 to 25 rIC executions per second 3. Select some text with the mouse and move your mouse a round. This forces some rendering. 4. Observe that rIC executions *increase* up to 60 per second. It seems very strange that rendering would produce more idle time compared to not rendering. In contrast, chrome maxes out the CPU at ~170k rIC executions per second on my machine on this site.
What does timeRemaining say? ~20 * 50ms = 1000ms, while 60 * 16.7 = 1000ms. That is, it's the difference between long and short idle periods. If we expect more calls during long period.
I changed the demo to sum the timeRemaining() and average it over a second. On my desktop its showing my something along the lines of: requestIdleCallback rate (executions / second): 13 requestIdleCallback deadline (total idle milliseconds / second): 650 So I believe it is setting a timeRemaining() of 50ms. Its not running quite at 20Hz though. If I force rendering the summed deadline time also goes up: requestIdleCallback rate (executions / second): 60 requestIdleCallback deadline (total idle milliseconds / second): 825 Its not as dramatic as the callback rate looked, but its still a bit unexpected that more work produces more idle time here.
Updated the title to reflect that the overall deadline time remaining is reported drops when rendering is not happening. The fact that fewer callbacks are made is not a problem.
Summary: requestIdleCallback() fires unusually slow when there is no rendering happening → requestIdleCallback() reports less idle time when there is no rendering happening
Priority: -- → P2
Moving to p3 because no activity for at least 1 year(s). See https://github.com/mozilla/bug-handling/blob/master/policy/triage-bugzilla.md#how-do-you-triage for more information
Priority: P2 → P3
Component: DOM → DOM: Core & HTML
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.