publicVsPrivate

Benchmark created by Tomás Corral on


Preparation HTML

<script>
  var Element = function()
  {
      var oPriv = 'test';
      this.oPublic = 'test';
      this.getPrivate = function()
      {
          return oPriv;
      }
  };
  Element.prototype.getPublic = function()
  {
      return this.oPublic;
  };
  var oElement = new Element();
</script>

Test runner

Ready to run.

Testing in
TestOps/sec
Private access only from a method
var oPrivate = oElement.getPrivate();
ready
Public access through a method
var oPublic = oElement.getPublic();
ready
Public access accessing the property without method implied
var oPublic = oElement.oPublic;
ready

Revisions

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

  • Revision 1: published by Tomás Corral on