test

Benchmark created on


Setup

let position = {x:0,y:0,z:0}

position.x = Math.random()
position.y = Math.random()
position.z = Math.random()

let width =Math.random()
let height =Math.random()
let depth =Math.random()

Test runner

Ready to run.

Testing in
TestOps/sec
1

 let corners = [];

 let signs = [[-1, -1, -1], [-1, -1, 1], [-1, 1, -1], [-1, 1, 1], [1, -1, -1], [1, -1, 1], [1, 1, -1], [1, 1, 1]];

 for (let i = 0; i < signs.length; i++) { 
  let corner = {}; 
 corner.x = position.x + signs[i][0] * width * 0.5; corner.y = position.y + signs[i][1] * height * 0.5; corner.z = position.z + signs[i][2] * depth * 0.5;  corners.push(corner); }
ready
2
 let corners = [];

let corner1 = { x: position.x - width * 0.5, y: position.y - height * 0.5, z: position.z - depth * 0.5 }; // On ajoute le coin au tableau corners.push(corner1);

 let corner2 = { x: position.x + width * 0.5, y: position.y - height * 0.5, z: position.z - depth * 0.5 }; // On ajoute le coin au tableau corners.push(corner2);
 let corner3 = { x: position.x + width * 0.5, y: position.y + height * 0.5, z: position.z - depth * 0.5 }; // On ajoute le coin au tableau corners.push(corner3);

 let corner4 = { x: position.x - width * 0.5, y: position.y + height * 0.5, z: position.z - depth * 0.5 }; 

 let corner5 = { x: position.x - width * 0.5, y: position.y - height * 0.5, z: position.z + depth * 0.5 }; // On ajoute le coin au tableau corners.push(corner5);
 let corner6 = { x: position.x + width * 0.5, y: position.y - height * 0.5, z: position.z + depth * 0.5 }; // On ajoute le coin au tableau corners.push(corner6);

 let corner7 = { x: position.x + width * 0.5, y: position.y + height * 0.5, z: position.z + depth * 0.5 }; // On ajoute le coin au tableau corners.push(corner7);

 let corner8 = { x: position.x - width * 0.5, y: position.y + height * 0.5, z: position.z + depth * 0.5};
// On ajoute le coin au tableau
corners.push(corner8);
ready

Revisions

You can edit these tests or add more tests to this page by appending /edit to the URL.