Script Preparation code:
x
 
let s10MB = "0123456789".repeat(1000*1000);
var strings10MB = Array.from(Array(20)).map(o=>s10MB + String.fromCharCode(32+~~(Math.random()*96)));
function hashString(input) {
    var encoder = new TextEncoder();
    return crypto.subtle.digest('SHA-1', encoder.encode(input)).then(function (hashBuffer) {
      var hashArray = Array.from(new Uint8Array(hashBuffer));
      return hashArray.map(byte => byte.toString(16).padStart(2, '0')).join('');
    });
}
Tests:
  • ===

     
    const s1 = strings10MB[~~(strings10MB.length*Math.random())];
    const s2 = strings10MB[~~(strings10MB.length*Math.random())];
    const b = s1 === s2;
  • SHA-1

     
    const s1 = strings10MB[~~(strings10MB.length*Math.random())];
    const s2 = strings10MB[~~(strings10MB.length*Math.random())];
    const hash1 = hashString(s1);
    const hash2 = hashString(s2);
    const b = hash1 === hash2;
Rendered benchmark preparation results:

Suite status: <idle, ready to run>

Previous results

Experimental features:

  • Test case name Result
    ===
    SHA-1

    Fastest: N/A

    Slowest: N/A

Latest run results:
Run details: (Test run date: 2 months ago)
Mozilla/5.0 (iPhone; CPU iPhone OS 18_3_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/18.3 Mobile/15E148 Safari/604.1
Mobile Safari 18 on iOS 18.3.1
View result in a separate tab
Test name Executions per second
=== 21939.2 Ops/sec
SHA-1 141.9 Ops/sec