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

Function run

benchmark/test_runner/global-sequential-tests.js:14–39  ·  view source on GitHub ↗
(n, type)

Source from the content-addressed store, hash-verified

12});
13
14async function run(n, type) {
15 // eslint-disable-next-line no-unused-vars
16 let avoidV8Optimization;
17
18 const promises = new Array(n);
19 switch (type) {
20 case 'sync': {
21 for (let i = 0; i < n; i++) {
22 await it(`${i}`, () => {
23 avoidV8Optimization = i;
24 });
25 }
26 break;
27 }
28
29 case 'async':
30 for (let i = 0; i < n; i++) {
31 await it(`${i}`, async () => {
32 avoidV8Optimization = i;
33 });
34 }
35 break;
36 }
37
38 await Promise.all(promises);
39}
40
41function main({ n }) {
42 bench.start();

Callers 1

mainFunction · 0.70

Calls 2

allMethod · 0.80
itFunction · 0.50

Tested by

no test coverage detected