stringvsregex (v8)

Revision 8 of this benchmark created on


Preparation HTML

<script>var txt = "I expect five hundred dollars ($500). and new brackets ($600)";</script>

Test runner

Ready to run.

Testing in
TestOps/sec
string
    var newTxt = txt.split('(');
    for (var i = 1; i < newTxt.length; i++) {
      console.log(newTxt[i].split(')')[0]);
    }
ready
regex
var regExp = /\(([^)]+)\)/g;
var matches = txt.match(regExp);
for (var i = 0; i < matches.length; i++) {
  var str = matches[i];
  console.log(str.substring(1, str.length - 1));
}
ready

Revisions

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