Test name | Executions per second |
---|---|
String concatenation (from Uint8Array) | 97165.8 Ops/sec |
Array map join | 586573.6 Ops/sec |
String concatenation (from Uint8Array converted to Array) | 600025.1 Ops/sec |
var text = '鉴于对人类家庭所有成员的固有尊严及其平等的和不移的权利的承认,乃是世界自由、正义与和平的基础';
var uint8Array = new TextEncoder().encode(text);
let byteStr = '';
uint8Array.forEach(i => { byteStr += String.fromCharCode(i); });
let byteStr = new Array(uint8Array).map(i => String.fromCharCode(i)).join('');
let byteStr = '';
new Array(uint8Array).forEach(i => { byteStr += String.fromCharCode(i); });