prototype methods vs object methods

JavaScript performance comparison

Test case created by Parris

Preparation code

Benchmark.prototype.setup = function() {
    function Bob() {
    var b = new Bob();
    Bob.prototype.testproto = function() {};
    b.testobj = function() {};

Test runner

Warning! For accurate results, please disable Firebug before running the tests. (Why?)

Java applet disabled.

Testing in unknown unknown
Test Ops/sec
Prototype Method Call
Object Method Call

Compare results of other browsers


You can edit these tests or add even more tests to this page by appending /edit to the URL. Here’s a list of current revisions for this page:

1 comment

jeremy commented :

Cool test. Nice, simple, useful. First test that came up at the top of my search for when I wanted to test the very same thing.

Comment form temporarily disabled.

Add a comment