History

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.

Avi Halachmi (:avih) committed 5 years ago

Commit 0427fe91 parent 76b1ac51 file · +1 −1Browse files

Showing the changes to player/javascript (1 of 1 file). Show all

Unified · Split

player/javascript/defaults.js+1−1
@@ -751,7 +751,7 @@ g.mp_event_loop = function mp_event_loop() { · 750 unmodified lines
751751 wait = 0; // poll the next one
752752 } else {
753753 wait = process_timers() / 1000;
754− if (wait != 0) {
754+ if (wait != 0 && iobservers.length) {
755755 notify_idle_observers(); // can add timers -> recalculate wait
756756 wait = peek_timers_wait() / 1000;
757757 }

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t