Skip to content

Commit 9b549c1

Browse files
joyeecheungtargos
authored andcommitted
benchmark: add startup benchmark for loading public modules
Adding a new benchmark for testing the performance of loading available public modules. PR-URL: #35816 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Rich Trott <[email protected]>
1 parent fb71964 commit 9b549c1

File tree

2 files changed

+51
-1
lines changed

2 files changed

+51
-1
lines changed
+46
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
'use strict';
2+
3+
const list = [
4+
'async_hooks',
5+
'assert',
6+
'buffer',
7+
'child_process',
8+
'console',
9+
'constants',
10+
'crypto',
11+
'cluster',
12+
'dgram',
13+
'dns',
14+
'domain',
15+
'events',
16+
'fs',
17+
'http',
18+
'http2',
19+
'https',
20+
'inspector',
21+
'module',
22+
'net',
23+
'os',
24+
'path',
25+
'perf_hooks',
26+
'process',
27+
'punycode',
28+
'querystring',
29+
'readline',
30+
'repl',
31+
'stream',
32+
'string_decoder',
33+
'timers',
34+
'tls',
35+
'trace_events',
36+
'tty',
37+
'url',
38+
'util',
39+
'vm',
40+
'zlib',
41+
];
42+
43+
for (let i = 0; i < list.length; ++i) {
44+
const item = list[i];
45+
require(item);
46+
}

benchmark/misc/startup.js

+5-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,11 @@ let Worker; // Lazy loaded in main
77

88
const bench = common.createBenchmark(main, {
99
dur: [1],
10-
script: ['benchmark/fixtures/require-cachable', 'test/fixtures/semicolon'],
10+
script: [
11+
'benchmark/fixtures/require-builtins',
12+
'benchmark/fixtures/require-cachable',
13+
'test/fixtures/semicolon',
14+
],
1115
mode: ['process', 'worker']
1216
}, {
1317
flags: ['--expose-internals']

0 commit comments

Comments
 (0)