Regex.test on function

Benchmark created by vamp on


Setup

var fn = function(){ return "here is some code that will be matched"; },
        regex = /\bwill\b/,
        toString = Function.prototype.toString;

Test runner

Ready to run.

Testing in
TestOps/sec
"fast" toString
regex.test(""+fn)
ready
simple
regex.test(fn)
ready
simple + toString call
regex.test(toString.call(fn))
ready
toString of function
regex.test(fn.toString())
ready

Revisions

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

  • Revision 1: published by vamp on