Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36
Chrome 108
Windows
Desktop
2 years ago
Test name Executions per second
For-loop 30537.4 Ops/sec
String.fromCharCode.apply 1835767.1 Ops/sec
Script Preparation code:
AخA
 
var chars = [239,15,2,1,227,15,118,2,68,63,49,59,56,90,0,44,15,143,1,206,15,251,7,255,56,15,43,2,206,15,225,0,255,74,15,135,3,255,56,15,74,1,71,15,0,3,255,74,15,92,1,242,15,172,8,44,15,63,0,107,15,194,1,242,15,5,1,224,15,118,2,65,15,184,11,255,17,63,49,59,56,234,6,71,15,90,0,218,15,180,3,224,15,243,0,255,56,15,42,3,218,15,237,0,161,15,235,2,255,56,15,74,1,255,8,15,3,9,65,15,84,0,86,15,215];
Tests:
  • For-loop

     
    var s = "";
    for(var i=0,l=chars.length; i<l; i++)
        s += String.fromCharCode(chars[i]);
  • String.fromCharCode.apply

     
    var s = String.fromCharCode.apply(null, chars);