Var declarations worth it?

Benchmark created on


Preparation HTML

<script>
  function Test() {
   x = 10;
  }
  
  var Hello = new Test();
  
  Test.prototype.without = function() {
   this.x++;
   this.x++;
   this.x++;
   this.x++;
   this.x++
  }
  
  Test.prototype.with = function() {
   var testX = this.x;
   testX++;
   testX++;
   testX++;
   testX++;
   testX++;
  }
</script>

Test runner

Ready to run.

Testing in
TestOps/sec
Without
Hello.without();
ready
With
Hello.with();
ready

Revisions

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