Exec() vs. Match() vs Test() (v2)

Revision 2 of this benchmark created by Fabien Ménager on


Description

Tests the performance between Javascript's .exec(), .match() and .test().

Note that the .test() testcase doesn't give the same results as the others (it gives only a boolean).

Preparation HTML

<script>
  var regex = /\d+_(\d+)_/;
  var value = "asdfjalsdkfj_89734_08934_asdaskjdk";
</script>

Test runner

Ready to run.

Testing in
TestOps/sec
.match()
value.match(regex)
ready
.exec()
regex.exec(value)
ready
.test()
regex.test(value)
ready

Revisions

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