var global vs local 2

JavaScript performance comparison

Test case created by ahomegane

Preparation code

<script>
var a = 3;
</script>
      
<script>
Benchmark.prototype.setup = function() {
    function global() {
      var _b = 4;
      return a * _b;
    }
    function local() {
      var _a = a;
      var _b = 4;
      return _a * _b;
    }

};
</script>

Test runner

Warning! For accurate results, please disable Firebug before running the tests. (Why?)

Java applet disabled.

Testing in CCBot 2.0.0 / Other 0.0.0
Test Ops/sec
global
global();
pending…
local
local();
pending…

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

Compare results of other browsers

0 Comments