Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
large string size comparison
Worst case large string comparison.
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:129.0) Gecko/20100101 Firefox/129.0
Browser:
Firefox 129
Operating system:
Windows
Device Platform:
Desktop
Date tested:
one year ago
Test name
Executions per second
string comparison
326450336.0 Ops/sec
string length comparison
322187232.0 Ops/sec
Script Preparation code:
let s1MB = "0123456789".repeat(1000*100); var strings1MB = Array.from(Array(20)).map(o=>s1MB + String.fromCharCode(32+~~(Math.random()*96)))
Tests:
string comparison
const s1 = strings1MB[~~(strings1MB.length*Math.random())]; const s2 = strings1MB[~~(strings1MB.length*Math.random())]+"a"; const b = s1 === s2;
string length comparison
const s1 = strings1MB[~~(strings1MB.length*Math.random())]; const s2 = strings1MB[~~(strings1MB.length*Math.random())]+"a"; const b = s1.length === s2.length;