Test case details

Preparation Code

var code = []; for (var i = 0; i < 10000; i++) { code.push(`o[${Math.random()}] = ${Math.random()};`); } var add_properties = new Function("var o = {}; "+code.join(" ") + " return o; "); var object_literal = new Function("return " + JSON.stringify(full)); var full = add_properties(); var assigned_properties = new Function("var o = {}; Object.assign(o, " + JSON.stringify(full) + "); return o;"); var spread_properties = function() { var o = { ...full }; return o; };

Test cases

Test #1

add_properties();

Test #2

object_literal();

Test #3

assigned_properties();

Test #4

spread_properties();