create vs new

Benchmark created by Epeli on


Preparation HTML

<script>
  function ProtytypeTest() {
   this.a = 1;
  }
  
  ProtytypeTest.prototype.hello = function() {
   console.log("hello");
  
   defTest = {
    a: 1,
    hello: function() {
     console.log("hello");
    }
   };
</script>

Test runner

Ready to run.

Testing in
TestOps/sec
new
var my = ProtytypeTest();
ready
Object.create
var my = Object.create(defTest);
ready

Revisions

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

  • Revision 1: published by Epeli on