regex create speed

Benchmark created on


Setup

const examples = [
	'Sed ut perspiciatis unde omnis iste ssp_exp error sit voluptatem accusantium doloremque laudantium',
	'But I must explain to you how all this mistaken idea of ssp_ctl pleasure and praising pain was born and I will give',
	'At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti'
]

Test runner

Ready to run.

Testing in
TestOps/sec
in function
function check (example) {
	const isExp = /ssp_exp/.test(example);
	const isCtl = /ssp_ctl/.test(example);
	
	return isExp ? 'exp' : isCtl ? 'ctl' : 'miss';
}

const result = examples.map(check);
ready
in global
const expReg = /ssp_exp/;
const expCtl = /ssp_ctl/;

function check (example) {
	const isExp = expReg.test(example);
	const isCtl = expCtl.test(example);
	
	return isExp ? 'exp' : isCtl ? 'ctl' : 'miss';
}

const result = examples.map(check);
ready

Revisions

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