join array versus concatenate

Benchmark created on


Setup

rand = Math.random() < 0.5;

Test runner

Ready to run.

Testing in
TestOps/sec
join array
const gogo = ["wa","boo","too"].join(rand ? ':' : '');
ready
concatenate string
if (rand) {
	const gogo = "wa" + ":" + "boo" + ":" + "too";
} else {
	const gogo = "wa" + "boo" + "too";
}
ready

Revisions

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