HTML Preparation code:
AخA
 
1
<style>
2
#container * {
3
  display: flex;
4
  flex: 1 1 50px;
5
  background: red;
6
}
7
#container .tick {
8
  flex-direction: row
9
  width: 20px;
10
  height: auto;
11
}
12
#container .tock {
13
  flex-direction: column
14
  width: auto;
15
  height: 20px;
16
}
17
</style>
18
<div id="container"></div>
Script Preparation code:
x
 
const container = document.getElementById("container");
const depth = 10;
const childrenPerLevel = 3;
/**
 * @param {HTMLElement} parent
 * @param {boolean} isTick
 */
const addElement = (parent, isTick) => {
  const el = document.createElement("div");
  el.classList.add(isTick ? "tick" : "tock");
  parent.appendChild(el);
  return el;
};
let currLevel = [container];
let nextLevel = [];
for (let i = 0; i < depth; i++) {
  for (const parent of currLevel) {
    for (let j = 0; j < childrenPerLevel; j++) {
      nextLevel.push(addElement(parent, i % 2 === 0));
    }
  }
  currLevel = nextLevel;
  nextLevel = [];
}
Tests:
  • elementFromPoint

     
    const n = 1000;
    const nsq = Math.floor(Math.sqrt(n));
    const arr = Array(n).fill(0).map((v,i)=>i);
    arr.map((v,i)=>document.elementFromPoint(i%nsq, Math.floor(i/nsq)));
  • second

     
    console.log(".");
Rendered benchmark preparation results:

Suite status: <idle, ready to run>

Previous results

Experimental features:

  • Test case name Result
    elementFromPoint
    second

    Fastest: N/A

    Slowest: N/A

Latest run results:
Run details: (Test run date: 2 days ago)
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/135.0.0.0 Safari/537.36
Chrome 135 on Mac OS X 10.15.7
View result in a separate tab
Test name Executions per second
elementFromPoint 476.0 Ops/sec
second 527051.1 Ops/sec