diff options
author | Avi Halachmi (:avih) <avihpit@yahoo.com> | 2021-06-22 18:17:09 +0300 |
---|---|---|
committer | Avi Halachmi (:avih) <avihpit@yahoo.com> | 2021-06-22 18:17:11 +0300 |
commit | 0427fe97e1d162116a51754c92fcca46533112fe (patch) | |
tree | dd531743ae8359a64769293ec7d904966ae29c56 | |
parent | 76b1ac57a4f49ff2c7f18b7e46aefa7fb3362984 (diff) | |
download | mpv-0427fe97e1d162116a51754c92fcca46533112fe.tar.bz2 mpv-0427fe97e1d162116a51754c92fcca46533112fe.tar.xz |
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.
-rw-r--r-- | player/javascript/defaults.js | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/player/javascript/defaults.js b/player/javascript/defaults.js index 037f931d94..91f1f52517 100644 --- a/player/javascript/defaults.js +++ b/player/javascript/defaults.js @@ -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; } |