RegExp timing

Benchmark created by Arthur Corenzan on


Description

Check what method of regexp is fastest

Test runner

Ready to run.

Testing in
TestOps/sec
new RegExp
var re = new RegExp('sample', 'g'),
    i;
for (i = 10; i--;) {
  "sample".match(re);
}
ready
literal
var re = /sample/g,
    i;
for (i = 10; i--;) {
  "sample".match(re);
}
ready
eval
var re = eval('/sample/g'),
    i;
for (i = 10; i--;) {
  "sample".match(re);
}
ready

Revisions

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

  • Revision 1: published by Arthur Corenzan on
  • Revision 2: published on