String Comp

Benchmark created on


Setup

function buildString(){
	return Math.random().toString(20).substr(2, 5000)
}

function compareA(a, b) {
	return a === b;
}

function compareB(a, b) {
	return a[0] === b[0] && a === b;
}

Test runner

Ready to run.

Testing in
TestOps/sec
Normal
const a = buildString();
const b = buildString();

compareA(a, b);
ready
Pre-check first char
const a = buildString();
const b = buildString();

compareB(a, b);
ready

Revisions

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