instance method vs prototype method

Benchmark created by Couto on


Preparation HTML

<script>
  var Wasabi = function() {},
      counter = 10000,
      collection = {};
</script>

Test runner

Ready to run.

Testing in
TestOps/sec
instance method
Wasabi.noodle = function() {
 return true
};

for (counter; counter >= 0; counter -= 1) {
 collection[counter] = new Wasabi();
}
ready
prototype method
Wasabi.prototype.noodle = function() {
 return true
};

for (counter; counter >= 0; counter -= 1) {
 collection[counter] = new Wasabi();
}
ready

Revisions

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

  • Revision 1: published by Couto on
  • Revision 2: published by Aleksy V Zapparov on