closure - write to global var

Benchmark created by closure - write to global var on


Preparation HTML

<script>
  var v = 0;
  
  f1 = function() {
   v++;
  };
  (function() {
   f2 = function() {
    v++;
   };
   (function() {
    f3 = function() {
     v++;
    };
   })();
   (function() {
    (function() {
     f4 = function() {
      v++;
     };
    })();
   })();
   (function() {
    (function() {
     (function() {
      f5 = function() {
       v++;
      };
     })();
    })();
   })();
  })();
</script>

Test runner

Ready to run.

Testing in
TestOps/sec
f0, without fn
v++;
ready
f1
f1();
ready
f2
f2();
ready
f3
f3();
ready
f4
f4();
ready
f5
f5();
ready

Revisions

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

  • Revision 1: published by closure - write to global var on