regex flags

Benchmark created on


Setup

const rx = /thing/img

Test runner

Ready to run.

Testing in
TestOps/sec
tostring slice lastindexof
return rx.toString().slice(rx.toString().lastIndexOf("/") + 1);
ready
loop to find trailling /
let p;
const s = rx.toString();
for( let i = 0; i <s.length; i++) {
	if( s.charCodeAt(i) == 47) {
		p = i;
	}
}
return rx.toString().slice(p+1);
ready

Revisions

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