Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
Uint8Array.fromBase64
Test Uint8Array.fromBase64 performance
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:148.0) Gecko/20100101 Firefox/148.0
Browser:
Firefox 148
Operating system:
Mac OS X 10.15
Device Platform:
Desktop
Date tested:
2 months ago
Test name
Executions per second
fromBase64a (Uint8Array.fromBase64)
134.3 Ops/sec
fromBase64b (traditional)
17.1 Ops/sec
HTML Preparation code:
<!--your preparation HTML code goes here-->
Script Preparation code:
var fromBase64a = Uint8Array.fromBase64?.bind(Uint8Array); var fromBase64b = ((b64) => { const binStr = atob(b64); const len = binStr.length; input = new Uint8Array(len); for (let i = 0; i < len; i++) input[i] = binStr.charCodeAt(i); return input; }); var fromBase64c = (b64) => Uint8Array.from(atob(b64), c => c.charCodeAt(0)); function generateBase64TestSample({ repeat = 1000, includeUnicode = true } = {}) { const baseChunk = ` Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. 0123456789 !@#$%^&*()_+-=[]{}|;:',.<>/? `; const unicodeChunk = ` Unicode test: 🚀🔥✨ café naïve 中文 العربية русский `; const text = (baseChunk + (includeUnicode ? unicodeChunk : "")) .repeat(repeat) .trim(); const base64 = typeof Buffer !== "undefined" ? Buffer.from(text, "utf-8").toString("base64") : btoa(unescape(encodeURIComponent(text))); return { originalText: text, base64, length: text.length, base64Length: base64.length }; } var samples = new Array(30).fill(0).map(e => generateBase64TestSample());
Tests:
fromBase64a (Uint8Array.fromBase64)
for (let i = 0, l = samples.length; i < l; i++) { fromBase64a(samples[i].base64); }
fromBase64b (traditional)
for (let i = 0, l = samples.length; i < l; i++) { fromBase64b(samples[i].base64); }
fromBase64c (Uint8Array.from)
for (let i = 0, l = samples.length; i < l; i++) { fromBase64c(samples[i].base64); }