Prototype Chain Access Performance

Benchmark created by Vahe Evoyan 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
book1.sayTitle();
ready
Write
book1.setTitle("Hello");
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