Regex TEst

Benchmark created by will on


Setup

var r;
    var name = "a foo bar";
    var inline = /(?:^| )foo(?: |$)/;
    var object = RegExp('(?:^| )foo(?: |$)');
    
    
    function inlineRegExp(node) {
      return /(?:^| )foo(?: |$)/.test(node);
    }
    
    function storedInline(node) {
      return inline.test(node);
    }
  
    function storedObject(node) {
      return object.test(node);
    }

Test runner

Ready to run.

Testing in
TestOps/sec
inline
inlineRegExp(name);
ready
storedInline
storedInline(name)
ready
storedObject
storedObject(name)
ready

Revisions

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