base64encode

Benchmark created on


Setup

const data = crypto.getRandomValues(new Uint8Array(1 << 8));

Test runner

Ready to run.

Testing in
TestOps/sec
btoa
console.log(btoa(Array.from(data, (x) => String.fromCodePoint(x)).join("")));
ready
FileReader
//return new Promise((resolve) => {
	const reader = new FileReader();
	reader.onload = () => {
		console.log(reader.result.split(',', 2)[1]);
	};
	reader.readAsDataURL(new Blob([data]));
//})
ready

Revisions

You can edit these tests or add more tests to this page by appending /edit to the URL.