Create functions from strings (v5)

Revision 5 of this benchmark created on


Setup

var inlineFunc = function(a, b) { return a + b; };
    var returnFunc = new Function("return " + "function (a, b) { return a + b; }")();
    eval("var evalFunc = function (a, b) { return a + b; };");
    var argFunc = new Function("a", "b", "return a + b;");

Test runner

Ready to run.

Testing in
TestOps/sec
Return
returnFunc(1,2);
ready
Arg
argFunc(1,2);
ready
Eval
evalFunc(1,2);
ready
Inline
inlineFunc(1,2);
ready

Revisions

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