Exec() vs. Match() vs Test() (v4)

Revision 4 of this benchmark created 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

Revisions

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