Layering

Benchmark created on


Setup

var obj = {};
[...Array(1000)].map((_, idx) => obj[`prop_${idx}`] = 1)


function Create() {}
function layer(obj) {
    Create.prototype = obj;
    return new Create();
}

Test runner

Ready to run.

Testing in
TestOps/sec
Spread
var layer1 = {...obj}
ready
Prototype
var layer2 = layer(obj)
ready

Revisions

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