Script Preparation code:
x
 
var Foo = function() {};
Foo.prototype._property = 'foo';
Foo.prototype.propertyAccess = function(param) {
  var property = this._property;
  this.noCache(param);
}
Foo.prototype.noCache = function(param) {
  console.log(this._property + '' + param);
}
var Bar = function() {};
Bar.prototype._property = 'bar';
Bar.prototype.propertyAccess = function(param) {
  var property = this._property;
  this.cache(property, param);
}
Bar.prototype.cache = function(property, param) {
  console.log(property + ' ' + param);
}
Tests:
  • Property access

     
    var foo = new Foo(),
        i = 1000;
    while(i--) {
      foo.propertyAccess(i);
    }
  • Cached value

     
    var bar = new Bar(),
        i = 1000;
    while(i--) {
      bar.propertyAccess(i);
    }
Rendered benchmark preparation results:

Suite status: <idle, ready to run>

Previous results

Experimental features:

  • Test case name Result
    Property access
    Cached value

    Fastest: N/A

    Slowest: N/A

Latest run results:
Run details: (Test run date: 5 years ago)
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.132 Safari/537.36
Chrome 80 on Mac OS X 10.15.1
View result in a separate tab
Test name Executions per second
Property access 61.5 Ops/sec
Cached value 62.4 Ops/sec