accessor perf

JavaScript performance comparison

Test case created by John-David Dalton

Preparation code


      
      <script>
Benchmark.prototype.setup = function() {
  var i = 0;
  
  var normal = { 'x': 0 };
  var created = Object.create(null);
  var accessor = Object.defineProperty({}, 'x', {
    'configurable': true,
    'enumerable': true,
    'get': function() {
      return this._x;
     },
     'set': function(value) {
       this._x = value;
     }
  });

};
</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
normal
normal.x = i++;
pending…
Object.create()
created.x = i++;
pending…
using accessors
accessor.x = i++;
pending…

Compare results of other browsers

Revisions

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

0 Comments