Test uppercase

Benchmark created on


Preparation HTML

<script>
const str = 'AaBb';
const compiledRegexp = new RegExp('[A-Z]');
</script>

Test runner

Ready to run.

Testing in
TestOps/sec
Regexp
for (let i = 0; i < 1000; i++) {
	for (let char of str) {
		/[A-Z]/.test(char);
	}
}
ready
Compiled regexp
for (let i = 0; i < 1000; i++) {
	for (let char of str) {
		compiledRegexp.test(char);
	}
}
ready
Equality
for (let i = 0; i < 1000; i++) {
	for (let char of str) {
		char === char.toUpperCase()
	}
}
ready

Revisions

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