Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
shiftArray
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/127.0.0.0 Safari/537.36
Browser:
Chrome 127
Operating system:
Mac OS X 10.15.7
Device Platform:
Desktop
Date tested:
one year ago
Test name
Executions per second
first
3362397.2 Ops/sec
second
4882179.0 Ops/sec
Tests:
first
const chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ!@#$%^&*()_+-=[]{}|¿€Ø<>?/~`"; let length = Math.floor(Math.random() * 11) + 8 const shiftArray = (arr) => { if (arr.length > 0 && arr.every((x) => x === "")) { length = Math.floor(Math.random() * 9) + 10; return []; } if (arr.length < length) { arr = [chars[Math.floor(Math.random() * 56)], ...arr]; } else if (arr.length < 24) { arr = ["", ...arr]; } else { arr = ["", ...arr]; arr.pop(); } return arr; }; shiftArray([])
second
const chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ!@#$%^&*()_+-=[]{}|¿€Ø<>?/~`"; let length = Math.floor(Math.random() * 11) + 8 const shiftArray = (arr) => { if (arr.length > 0 && arr.every((x) => x === "")) { length = Math.floor(Math.random() * 9) + 10; return []; } if (arr.length < length) { arr = [chars[Math.floor(Math.random() * 56)], ...arr]; } else if (arr.length < 24) { arr = ["", ...arr]; } else { arr = ["", ...arr]; arr.pop(); } return arr; }; shiftArray(["A","A","A","A","A","A","A","A","A","A","A","A","A","A","A","A","A","A","A","A","A"])