Test case details

Preparation Code

<svg width="1000" height="1000" xmlns="http://www.w3.org/2000/svg" id="canvas"> </svg>
const canvas = document.getElementById("canvas") for(let i = 0; i < 1000; i++) { const rect = document.createElementNS("http://www.w3.org/2000/svg", "rect"); canvas.append(rect); rect.setAttribute("id", "id-" + i); } let theMap = new Map(); const theSymbol = Symbol("the symbol");
while(canvas.children.length > 0) { canvas.children[0].remove(); } theMap = new Map();

Test cases

Test #1

let best = 0; for(let child of canvas.children) { theMap.set(child, "" + Math.random()); } for(let child of canvas.children) { const val = theMap.get(child); if(val > best) best = val; } console.log(best);

Test #2

let best = 0; for(let child of canvas.children) { child[theSymbol] = "" + Math.random(); } for(let child of canvas.children) { const val = child[theSymbol]; if(val > best) best = val; } console.log(best);

Test #3

let best = 0; for(let child of canvas.children) { child.setAttribute("data-num", Math.random()); } for(let child of canvas.children) { const val = child.getAttribute("data-num"); if(val > best) best = val; } console.log(best);