Test name | Executions per second |
---|---|
string comparison | 326450336.0 Ops/sec |
string length comparison | 322187232.0 Ops/sec |
let s1MB = "0123456789".repeat(1000*100);
var strings1MB = Array.from(Array(20)).map(o=>s1MB + String.fromCharCode(32+~~(Math.random()*96)))
const s1 = strings1MB[~~(strings1MB.length*Math.random())];
const s2 = strings1MB[~~(strings1MB.length*Math.random())]+"a";
const b = s1 === s2;
const s1 = strings1MB[~~(strings1MB.length*Math.random())];
const s2 = strings1MB[~~(strings1MB.length*Math.random())]+"a";
const b = s1.length === s2.length;