MCPcopy Index your code
hub / github.com/nodejs/node / main

Function main

benchmark/util/inspect.js:39–102  ·  view source on GitHub ↗
({ method, n, option })

Source from the content-addressed store, hash-verified

37}
38
39function main({ method, n, option }) {
40 let obj;
41 const options = opts[option];
42 switch (method) {
43 case 'Object':
44 benchmark(n, { a: 'a', b: 'b', c: 'c', d: 'd' }, options);
45 break;
46 case 'Object_empty':
47 benchmark(n, {}, options);
48 break;
49 case 'Object_deep_ln':
50 if (options)
51 options.depth = Infinity;
52 obj = { first:
53 { second:
54 { third:
55 { a: 'first',
56 b: 'second',
57 c: 'third',
58 d: 'fourth',
59 e: 'fifth',
60 f: 'sixth',
61 g: 'seventh' } } } };
62 benchmark(n, obj, options || { depth: Infinity });
63 break;
64 case 'String':
65 benchmark(n, 'Simple string', options);
66 break;
67 case 'String_complex':
68 benchmark(n, 'This string\nhas to be\tescaped!', options);
69 break;
70 case 'String_boxed':
71 benchmark(n, new String('string'), options);
72 break;
73 case 'Date':
74 benchmark(n, new Date(), options);
75 break;
76 case 'Set':
77 obj = new Set([5, 3]);
78 benchmark(n, obj, options);
79 break;
80 case 'Error':
81 benchmark(n, new Error('error'), options);
82 break;
83 case 'Array':
84 benchmark(n, Array(50).fill().map((_, i) => i), options);
85 break;
86 case 'TypedArray':
87 obj = new Uint8Array(Array(50).fill().map((_, i) => i));
88 benchmark(n, obj, options);
89 break;
90 case 'TypedArray_extra':
91 obj = new Uint8Array(Array(50).fill().map((_, i) => i));
92 obj.foo = 'bar';
93 obj[Symbol('baz')] = 5;
94 benchmark(n, obj, options);
95 break;
96 case 'Number':

Callers

nothing calls this directly

Calls 5

ArrayFunction · 0.85
fillMethod · 0.80
benchmarkFunction · 0.70
mapMethod · 0.65
SymbolFunction · 0.50

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…