Script Preparation code:
x
 
var [testDecode, testFCCodeBuf, testFCCodeArr, testFCPointBuf, testFCPointArr] = (function(){
  "use strict";
  var bytesArray = [84,104,105,115,32,105,115,32,97,32,115,97,109,112,108,101,32,112,97,114,97,103,114,97,112,104,46];
  var bufferArray = new Uint8Array(bytesArray);
  var decoder = new TextDecoder(); // default 'utf-8' or 'utf8'
  var {fromCharCode, fromCodePoint} = String;
  var retStr = "";
  self.getRetStr = function() {return retStr};
  
  function testDecode() {
    for (var i=0; i < 256; i=i+1|0) retStr = "" + decoder.decode(bufferArray);
  }
  function testFCCodeBuf() {
    for (var i=0; i < 256; i=i+1|0) retStr = "" + fromCharCode.apply(null, bufferArray);
  }
  function testFCCodeArr() {
    for (var i=0; i < 256; i=i+1|0) retStr = "" + fromCharCode.apply(null, bytesArray);
  }
  function testFCPointBuf() {
    for (var i=0; i < 256; i=i+1|0) retStr = "" + fromCodePoint.apply(null, bufferArray);
  }
  function testFCPointArr() {
    for (var i=0; i < 256; i=i+1|0) retStr = "" + fromCodePoint.apply(null, bytesArray);
  }
  
  return [testDecode, testFCCodeBuf, testFCCodeArr, testFCPointBuf, testFCPointArr];
})();
Tests:
  • TextDecoder on Uint8Array

     
    testDecode();
  • String.fromCharCode on Uint8Array

     
    testFCCodeBuf();
  • String.fromCharCode on Array

     
    testFCCodeArr();
  • String.fromCodePoint on Uint8Array

     
    testFCPointBuf();
  • String.fromCodePoint on Array

     
    testFCPointArr();
Rendered benchmark preparation results:

Suite status: <idle, ready to run>

Previous results

Experimental features:

  • Test case name Result
    TextDecoder on Uint8Array
    String.fromCharCode on Uint8Array
    String.fromCharCode on Array
    String.fromCodePoint on Uint8Array
    String.fromCodePoint on Array

    Fastest: N/A

    Slowest: N/A

Latest run results:
Run details: (Test run date: one month ago)
Mozilla/5.0 (X11; Linux x86_64; rv:135.0) Gecko/20100101 Firefox/135.0
Firefox 135 on Linux
View result in a separate tab
Test name Executions per second
TextDecoder on Uint8Array 29480.1 Ops/sec
String.fromCharCode on Uint8Array 15879.3 Ops/sec
String.fromCharCode on Array 57867.5 Ops/sec
String.fromCodePoint on Uint8Array 12409.2 Ops/sec
String.fromCodePoint on Array 27346.9 Ops/sec