Prototype Chain Access Performance (v2)

Revision 2 of this benchmark created by Mat Groves on


Setup

function Book(title, publisher) {
      this.title = title;
      this.publisher = publisher;
    }
    
    Book.prototype.sayTitle = function() {
      this.title;
    };
    
    Book.prototype.setTitle = function(t) {
      this.title = t;
    };
    
    var book1 = new Book("High Performance JavaScript", "Yahoo!");

Test runner

Ready to run.

Testing in
TestOps/sec
Read
var thing = book1.title;
ready
Write
var thing = book1["title"];
ready

Revisions

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

  • Revision 1: published by Vahe Evoyan on
  • Revision 2: published by Mat Groves on