diff options
author | Joyee Cheung <joyeec9h3@gmail.com> | 2020-10-26 18:54:41 +0300 |
---|---|---|
committer | Beth Griggs <bgriggs@redhat.com> | 2020-12-15 23:15:08 +0300 |
commit | 21d3ccf5df0bb85afb5d28ed39e087068cc9a7bf (patch) | |
tree | ac631a39ec1861d6b32db1aa366cd4f67416ada8 /benchmark | |
parent | 51ce1a2fa88f9a7a62402f428bce4da4b90825ba (diff) |
benchmark: add startup benchmark for loading public modules
Adding a new benchmark for testing the performance of loading
available public modules.
PR-URL: https://github.com/nodejs/node/pull/35816
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Diffstat (limited to 'benchmark')
-rw-r--r-- | benchmark/fixtures/require-builtins.js | 46 | ||||
-rw-r--r-- | benchmark/misc/startup.js | 6 |
2 files changed, 51 insertions, 1 deletions
diff --git a/benchmark/fixtures/require-builtins.js b/benchmark/fixtures/require-builtins.js new file mode 100644 index 00000000000..a100e9efd0c --- /dev/null +++ b/benchmark/fixtures/require-builtins.js @@ -0,0 +1,46 @@ +'use strict'; + +const list = [ + 'async_hooks', + 'assert', + 'buffer', + 'child_process', + 'console', + 'constants', + 'crypto', + 'cluster', + 'dgram', + 'dns', + 'domain', + 'events', + 'fs', + 'http', + 'http2', + 'https', + 'inspector', + 'module', + 'net', + 'os', + 'path', + 'perf_hooks', + 'process', + 'punycode', + 'querystring', + 'readline', + 'repl', + 'stream', + 'string_decoder', + 'timers', + 'tls', + 'trace_events', + 'tty', + 'url', + 'util', + 'vm', + 'zlib', +]; + +for (let i = 0; i < list.length; ++i) { + const item = list[i]; + require(item); +} diff --git a/benchmark/misc/startup.js b/benchmark/misc/startup.js index da24ee65199..dea5a31753f 100644 --- a/benchmark/misc/startup.js +++ b/benchmark/misc/startup.js @@ -7,7 +7,11 @@ let Worker; // Lazy loaded in main const bench = common.createBenchmark(main, { dur: [1], - script: ['benchmark/fixtures/require-cachable', 'test/fixtures/semicolon'], + script: [ + 'benchmark/fixtures/require-builtins', + 'benchmark/fixtures/require-cachable', + 'test/fixtures/semicolon', + ], mode: ['process', 'worker'] }, { flags: ['--expose-internals'] |