From: Steinar H. Gunderson Date: Sat, 24 Dec 2022 23:02:42 +0000 (+0100) Subject: Evidently clearTimeout() is expensive (~3 ms used on load), so do not call it unless... X-Git-Url: https://git.sesse.net/?p=remoteglot;a=commitdiff_plain;h=026c621f8c912aba3f53be9057078eefe9c92c6f Evidently clearTimeout() is expensive (~3 ms used on load), so do not call it unless we must. --- diff --git a/www/js/remoteglot.js b/www/js/remoteglot.js index f4581cf..7b030ca 100644 --- a/www/js/remoteglot.js +++ b/www/js/remoteglot.js @@ -1226,6 +1226,9 @@ let update_board = function() { return; } + if (clock_timer !== null) { + clearTimeout(clock_timer); + } update_clock(); // The score. @@ -1497,7 +1500,7 @@ let update_num_viewers = function(num_viewers) { } let update_clock = function() { - clearTimeout(clock_timer); + clock_timer = null; let data = displayed_analysis_data || current_analysis_data; if (!data) return;