empty function regex

Benchmark created by John Cockrell on


Description

fastest way to match an "empty" function

Setup

var fn = (function(){}).toString(),
        gn = (function(){ this.a = "fun" }).toString(),
        hn = (function(a){}).toString(),
        rx = /\(\s*\)\s*{\s*}/;

Test runner

Ready to run.

Testing in
TestOps/sec
String match()
fn.match(rx);
gn.match(rx);
hn.match(rx);
ready
RegExp test()
rx.test(fn);
rx.test(gn);
rx.test(hn);
ready

Revisions

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

  • Revision 1: published by John Cockrell on