Eval vs new Function vs function() (v2)

Revision 2 of this benchmark created by Avinash on


Test runner

Ready to run.

Testing in
TestOps/sec
Eval
eval('(function(test) { return test.a; })')({
  a: true
})
ready
new Function
new Function('test', 'return test.a;')({
  a: true
})
ready
function
(function(test) {
  return test.a
})({
  a: true
})
ready
eval (no args)
eval('(function() { return true; })')()
ready
new Function (no args)
new Function('return true;')()
ready
function(no args)
(function() {
  return true;
})()
ready

Revisions

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