xyz-method

Benchmark created on


Preparation HTML

<script>
  function Person1(name) {
   this.name = name;
  }
  Person1.prototype.setAge = function(age) {
   this.age = age;
   return this;
  }
  
  function Person2(name) {
   this.name = name;
  }
  Person2.prototype = {
   setAge: function(age) {
    this.age = age;
    return this;
   },
   constructor: Person2
  };
  
  var p1 = new Person1('Alpha');
  var p2 = new Person2('Alpha');
</script>

Test runner

Ready to run.

Testing in
TestOps/sec
origin proto method
p1.setAge(26);
ready
object proto method
p2.setAge(26);
ready

Revisions

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