Script Preparation code:
AخA
 
iterations = 1000;
function randomStringGen(n) {
    let strings = [];
    for (let i = 0; i < n; i++) {
      let s = Math.random().toString(36).substring(2, 15) + Math.random().toString(36).substring(2, 15);
      strings[i] = s;
    }
    return strings;
}
var randomStrings = randomStringGen(iterations);
var encoder = new TextEncoder(); 
Tests:
  • Blob

     
    var j = 0;
    for (let i = 0; i < iterations; i++) {
     new TextEncoder().encode(randomStrings.join('')).length
    }
  • TextEncoder

     
    var j = 0;
    for (let i = 0; i < iterations; i++) {
      new Blob([randomStrings.join('')]).size
    }
Rendered benchmark preparation results:

Suite status: <idle, ready to run>

Previous results

Experimental features:

  • Test case name Result
    Blob
    TextEncoder

    Fastest: N/A

    Slowest: N/A

Latest run results:
Run details: (Test run date: one year ago)
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/111.0.0.0 Safari/537.36
Chrome 111 on Mac OS X 10.15.7
View result in a separate tab
Test name Executions per second
Blob 17.9 Ops/sec
TextEncoder 4.1 Ops/sec