String building

Benchmark created on


Setup

const foo = new Array(100).fill('a');

Test runner

Ready to run.

Testing in
TestOps/sec
For loop
var res = '';
for (const x of foo) {
 res += `hello ${x}`;
}
ready
forEach
var res = '';
foo.forEach(x => {
	res += `hello ${x}`;
});
ready
map + join
var res = '';
res = foo.map(x => `hello ${x}`).join('')
ready

Revisions

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