Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
Shuffled Array Cache Test 4
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36
Browser:
Chrome 119
Operating system:
Windows
Device Platform:
Desktop
Date tested:
2 years ago
Test name
Executions per second
Sorted
56.5 Ops/sec
Shuffled
28.5 Ops/sec
Shuffled reorder
60.5 Ops/sec
Script Preparation code:
var sorted = new Array(200000); var shuffled = new Array(200000); class Vector { constructor() { this.x = 0; this.y = 0; this.z = 0; } } for (let i=0; i<200000; i++) { const obj = { position: new Vector(), scale: new Vector(), rotation: new Vector() }; sorted[i] = obj; shuffled[i] = obj; } for (let i=0; i<200000; i++) { const index = Math.floor(Math.random() * 200000); const temp = shuffled[i]; shuffled[i] = shuffled[index]; shuffled[index] = temp; }
Tests:
Sorted
for (let i=0; i<200000; i++) { const obj = sorted[i]; if (obj.position.x === 0) {} }
Shuffled
for (let i=0; i<200000; i++) { const obj = shuffled[i]; if (obj.position.x === 0) {} }
Shuffled reorder
const reordered = new Array(200000); for (let i=0; i<200000; i++) { reordered[i] = shuffled[i]; } for (let i=0; i<200000; i++) { const obj = reordered[i]; if (obj.position.x === 0) {} }