stringvsregex (v10)

Revision 10 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 matches = txt.match(/\(([^)]+)\)/g);
for (var i = 0; i < matches.length; i++) {
  console.log(matches[i].substring(1, matches[i].length - 1));
}
ready

Revisions

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