mirror of https://github.com/mpv-player/mpv
js: idle-observers: minor performance improvement
The idle-observers block has at least 3 function calls, and it was entered every time the script went into idle, however, we can save these calls by checking first that there are indeed such observers.
This commit is contained in:
parent
76b1ac57a4
commit
0427fe97e1
|
@ -751,7 +751,7 @@ g.mp_event_loop = function mp_event_loop() {
|
|||
wait = 0; // poll the next one
|
||||
} else {
|
||||
wait = process_timers() / 1000;
|
||||
if (wait != 0) {
|
||||
if (wait != 0 && iobservers.length) {
|
||||
notify_idle_observers(); // can add timers -> recalculate wait
|
||||
wait = peek_timers_wait() / 1000;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue