MCPcopy Create free account
hub / github.com/nodejs/node / main

Function main

benchmark/misc/util-extend-vs-object-assign.js:11–30  ·  view source on GitHub ↗
({ n, type })

Source from the content-addressed store, hash-verified

9});
10
11function main({ n, type }) {
12 let fn;
13 if (type === 'extend') {
14 fn = util._extend;
15 } else if (type === 'assign') {
16 fn = Object.assign;
17 }
18
19 // Force-optimize the method to test so that the benchmark doesn't
20 // get disrupted by the optimizer kicking in halfway through.
21 for (let i = 0; i < type.length * 10; i += 1)
22 fn({}, process.env);
23
24 const obj = new Proxy({}, { set: function(a, b, c) { return true; } });
25
26 bench.start();
27 for (let j = 0; j < n; j += 1)
28 fn(obj, process.env);
29 bench.end(n);
30}

Callers

nothing calls this directly

Calls 3

fnFunction · 0.50
startMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected