From 026c621f8c912aba3f53be9057078eefe9c92c6f Mon Sep 17 00:00:00 2001 From: "Steinar H. Gunderson" Date: Sun, 25 Dec 2022 00:02:42 +0100 Subject: [PATCH] Evidently clearTimeout() is expensive (~3 ms used on load), so do not call it unless we must. --- www/js/remoteglot.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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; -- 2.39.2