Function constructor vs Declared Function

Benchmark created by Christian C. Salvadó on


Preparation HTML

<script>
  var fn1 = new Function("for(var i=0; i<100; i++);"),
      fn2 = function() {
    for (var i = 0; i < 100; i++);
      };
</script>

Test runner

Ready to run.

Testing in
TestOps/sec
new Function
fn1();
ready
FunctionExpression
fn2();
ready

Revisions

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

  • Revision 1: published by Christian C. Salvadó on
  • Revision 3: published on