Open Bug 1872786 Opened 2 years ago Updated 4 months ago

Enable timer.auto_increase_timer_resolution on all (Windows) builds

Categories

(Core :: Performance Engineering, enhancement)

All
Windows 11
enhancement

Tracking

()

People

(Reporter: jlink, Assigned: jlink)

References

(Depends on 1 open bug, Blocks 1 open bug)

Details

(Keywords: webcompat:platform-bug, Whiteboard: [sp3])

User Story

user-impact-score:5.6

In https://bugzilla.mozilla.org/show_bug.cgi?id=1826224 we added the option to make Firefox automatically request high resolution Windows timers for foreground processes when not on battery power. That functionality was only enabled by default in Nightly builds, however, to give some time to see how well it works out.

The purpose of this bug is to enable this functionality by default in all (Windows) builds.

Do we have some results on how well it worked out?

Flags: needinfo?(jlink)

Just a quick update from me:
I tested it for a month now with the setting enabled. I experienced no issue so far.

Depends on: 1881627

@Andre: Thank you for following up!

@Jeff: I'm not aware of any actual problems (this bug was reported as a regression but really it just seems to have exposed a separate issue) and I've been made aware of one additional example of some functionality that is improved, which is roughly what I expected.

I've been pondering what the next steps should be here. While I think that it would beneficial and safe to enable this functionality as-is, because some sites implicitly rely on the behavior of high-resolution timers, that would create the situation where those sites that seem to be working fine when accessed while plugged in but behave differently when accessed while running on battery power. I would find that inconsistency confusing and frustrating.

From an efficiency and power consumption standpoint, it's also not desirable to keep the timer resolution cranked up when we don't need it.

I'm thinking that it would be better would be to crank up the timer resolution "only when it seems like we need to" (whether on battery power or not). Most pages probably don't need it most of the time but, when they do, it can be important.

I was initially thinking that it could be a pretty big amount of work to figure out (and maintain) the logic needed to reliably determine when high-resolution timers are needed. It think it can be much simpler though. We already have the concept of an acceptable delay for the firing of an nsTimer (based on how far in advance the timer was scheduled). We could simply request high-resolution timers iff there are any timers coming up that need to fire precisely (have small acceptable delays). It is these short-duration, high-precision timers are the ones that are most critically need to fire on time.

I've just created this bug to capture this and I will probably give this a try in the next week or two.

Do you understand why https://perftest.netlify.app/stylebench/ is improved by the increase in timer resolution? Are there other improvements that we know about?

Flags: needinfo?(jlink)
User Story: (updated)
You need to log in before you can comment on or make changes to this bug.