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.
Showing the changes to player/javascript (1 of 1 file). Show all
Unified · Split
| @@ -751,7 +751,7 @@ g.mp_event_loop = function mp_event_loop() { · 750 unmodified lines | |||
| 751 | wait = 0; // poll the next one | 751 | wait = 0; // poll the next one |
| 752 | } else { | 752 | } else { |
| 753 | wait = process_timers() / 1000; | 753 | wait = process_timers() / 1000; |
| 754 | if (wait != 0) { | 754 | if (wait != 0 && iobservers.length) { |
| 755 | notify_idle_observers(); // can add timers -> recalculate wait | 755 | notify_idle_observers(); // can add timers -> recalculate wait |
| 756 | wait = peek_timers_wait() / 1000; | 756 | wait = peek_timers_wait() / 1000; |
| 757 | } | 757 | } |