blob vs string concatenation

Benchmark created on


Setup

const a = new Int8Array(1 << 16);
const str = n => crypto.getRandomValues(a).toString().substring(0, n);

const txt = Array(11).fill(0).map((_,i) => str((i&1)?150000:10));

const blb = txt.map(t => new Blob([t], { type: "text/plain" }));

Test runner

Ready to run.

Testing in
TestOps/sec
blob concat 2 text
new Blob(blb).text().then(() => deferred.resolve())
ready
string join
txt.join("")
ready
string reduce
txt.reduce((a, v) => a + v)
ready

Revisions

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