DescriptionSet minimum Windows wait time to 1 ms in MessagePumpDefault::Run
On Windows if we call event_.TimedWait(delay); with a sub-ms delay
then the wait function will return immediately. This means we end up
busy waiting down to zero. Rounding these times up to 1 ms lets Chrome
go idle and saves a few percent of a core on some tests.
The symptom to watch for is lots of time being spent in QPCNow, called
from MessagePumpDefault::Run or from MessageLoop::DoDelayedWork.
This is the second attempt at fixing this bug. The first attempt tried
rounding down the short delays but this was stymied by other code that
didn't respect the rounding down.
One known problem is that some animations that try to run at 60 fps by
using setInterval(C,16) will drop from ~60 fps to ~58 fps. Those that
use requestAnimationFrame run at a steady rate of 60 fps.
BUG=487724
Committed: https://crrev.com/932c2457349e44eeb7b3152f8b49acd186e7057e
Cr-Commit-Position: refs/heads/master@{#331226}
Patch Set 1 #
Total comments: 1
Patch Set 2 : Simpler implementation using std::max #Patch Set 3 : Check for > zero first. #
Total comments: 1
Patch Set 4 : Remove unnecessary braces. #Patch Set 5 : Add missing header include. #Messages
Total messages: 17 (6 generated)
|