Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
MultiArray vs One-Dimensional Array
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:142.0) Gecko/20100101 Firefox/142.0
Browser:
Firefox 142
Operating system:
Ubuntu
Device Platform:
Desktop
Date tested:
8 months ago
Test name
Executions per second
Two Dimensional
28.7 Ops/sec
One Dimensional
38.6 Ops/sec
Script Preparation code:
function generateNoise(width, height) { // Iterate from Top-Left to Bottom-Right let noise = []; for (let y = 0; y < height; y++) { for (let x = 0; x < width; x++) { if (noise[x] == null) noise[x] = []; noise[x][y] = Math.random(); } } return noise; } function generateNoiseSingle(width, height) { // Iterate from Top-Left to Bottom-Right let noise = []; for (let y = 0; y < height; y++) { for (let x = 0; x < width; x++) { noise[xyToSingle(width, x, y)] = Math.random(); } } return noise; } function xyToSingle(width, x, y) { return (y * width) + x; }
Tests:
Two Dimensional
generateNoise(1000, 1000);
One Dimensional
generateNoiseSingle(1000, 1000);