From 49a2aff53230df3f09665933cc0bbd0c3cf224d6 Mon Sep 17 00:00:00 2001 From: Jonas Jenwald Date: Fri, 23 Feb 2024 14:20:53 +0100 Subject: [PATCH] Tweak how the `hexNumbers` Array, used by `Util.makeHexColor`, is built *Please note:* This is a micro optimization, hence I fully understand if the patch is rejected. Currently we create two temporary Arrays and have to iterate twice in total when building the final `hexNumbers` Array. With this patch there's only one temporary Array and a single iteration required to build the final `hexNumbers` Array. --- src/shared/util.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/shared/util.js b/src/shared/util.js index d0df815d5..4080818d4 100644 --- a/src/shared/util.js +++ b/src/shared/util.js @@ -641,7 +641,7 @@ class FeatureTest { } } -const hexNumbers = [...Array(256).keys()].map(n => +const hexNumbers = Array.from(Array(256).keys(), n => n.toString(16).padStart(2, "0") );