locglob

Benchmark created on


Description

Comparing global to local variable performance.

Preparation HTML

<script>
var x = 0, y = 0;

function sumGlobal () {
  for (x = 0; x < 10000; x++) {
    y += x;
  };
};

function sumLocal () {
  var a = x, b = y;
  for (a = 0; a < 10000; a++) {
    b+= a;
  };
};
</script>

Test runner

Ready to run.

Testing in
TestOps/sec
global
sumGlobal();
ready
local
sumLocal();
ready

Revisions

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