Object literal vs custom constructor

Benchmark created by Bubak9 on


Setup

var Foo = function (prop) {this.bar = prop;};

Test runner

Ready to run.

Testing in
TestOps/sec
Object literal
var x = {bar: 42};
ready
Const
var y = new Foo(42);
ready
Object literal 2
var z = {};
z.bar = 42;
ready

Revisions

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