Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
Encode byte string test (string concatenation vs. map join)
Encode byte string
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/134.0.0.0 Safari/537.36
Browser:
Chrome 134
Operating system:
Windows
Device Platform:
Desktop
Date tested:
one year ago
Test name
Executions per second
String concatenation (from Uint8Array)
620620.4 Ops/sec
Array map join
475546.2 Ops/sec
String concatenation (from Uint8Array converted to Array)
491062.5 Ops/sec
Script Preparation code:
var text = '鉴于对人类家庭所有成员的固有尊严及其平等的和不移的权利的承认,乃是世界自由、正义与和平的基础'; var uint8Array = new TextEncoder().encode(text);
Tests:
String concatenation (from Uint8Array)
let byteStr = ''; uint8Array.forEach(i => { byteStr += String.fromCharCode(i); });
Array map join
let byteStr = new Array(uint8Array).map(i => String.fromCharCode(i)).join('');
String concatenation (from Uint8Array converted to Array)
let byteStr = ''; new Array(uint8Array).forEach(i => { byteStr += String.fromCharCode(i); });