Files
test2/source
Campbell Barton 745f78f9f0 WM: improve timer precision for more precise playback
When a timer needs to execute during the idle time (currently 5ms), use
microsecond precision to ensure the timer isn't delayed by the idle
time.

This improves the precision of animation playback on systems that
support it
(WIN32, see note below).

In my tests FPS playback varied:

- 59.94 FPS would jitter between 58.13 & 63.11 FPS. 23.98 FPS would
- jitter between 23.68 & 24.31 FPS.

Using higher precision timers mostly resolves this issue although there
is still some jitter although it's now limited to ~0.01 FPS.

These values were measured with the FPS-Samples set to 1 to show the
real times between frames (without the values being smoothed out).

This is a continuation of a fix for #111579 which avoided the worst of
the jittering issues at higher frame rates.

It appears WIN32 doesn't support sleeping shorter than 1 millisecond via
`std::this_thread::sleep_for`, making this change have no benefit on
WIN32, from tests it also doesn't have any down sides, so avoid platform
specific logic. The WIN32 limitation is noted in code-comments. If a
method of higher precision method is available this can be investigated.
2023-08-30 10:57:20 +10:00
..
2023-08-28 15:01:05 +02:00