Monday, August 2, 2010

Power Update

An update on power-related stuff:
  • Patch to remove the 1/sec JavaScript timer should be pushed soon. This is one of the biggest sources of wakeups, and can drain your battery over time, so fixing this is very cool.
  • Patch to fix unnecessary image animation timers awaiting review. On certain websites, this can leave many, many useless timers, so on those websites this is even more important than the previous point.
  • Still working on patch for grouping timers - rewrote it with a new and better approach, works well locally but seeing some odd oranges on try server, not sure if random or not. Once this works, it will reduce the # of wakeups due to animations, probably by something like 10-20%
  • Patch with a nice scriptable API for freezing/throttling the content process waiting for feedback. Two main uses:
    • Freezing the content process when the OS tells us to. Still working out what the various OSes want us to do and when, see wiki page here.
    • Throttling websites that use too much power. As a first iteration of this idea, I was thinking about an addon that has a blacklist of websites that are known CPU hogs, and how much to throttle them.
  • Not strictly a power-related issue, but preloading the browser with SIG_STOP/CONT is also being worked on. What is really nice is this lets the browser be started almost instantly from the user's perspective, while being frozen until that time prevents it from using any power before that. Still need to work out the details of this though.


  1. Nice! I wonder if the JS timers will help Gmail CPU usage any. Is there a tryserver build or similar to test with?

  2. Have you looked into using the SetWaitableTimerEx API in Windows 7 so that the OS can group Gecko's timers with those in the rest of the system?

  3. limi: This is more relevant for battery life than CPU usage. The CPU usage will be lower, but very slightly. It matters over time, though, since even slight CPU use is much worse than no CPU use at all (that lets the CPU enter sleep mode, which saves a lot of power).

    Rob: Thanks, I'll look into that!