kpreid/cubes — Issue #22: Inhibit measurement updates when hidden
Author: kpreid
Created: 2012-03-04 05:09:04+00:00
State: open

The shiny new performance measurement subsystem has a noticeable idle CPU cost even when the window is hidden due to the measurement display updates for simulation steps. This should be fixed.

Two options I can see:

* Rework the main "loop" so that we always use requestAnimationFrame (rather than a mix of it and setInterval), unless it doesn't call back in reasonable time, in which case use setTimeout. In this way, we obtain an "is animation-visible" flag which we use to determine whether to update the measurement display. Getting the setInterval out of normal operation *might* also improve smoothness.

* Keep running requestAnimationFrame even if there is no need to draw, and do the measurement updates from its callback.