node/benchmark/fixtures/require-cachable.js
Joyee Cheung ad5c9b4463
benchmark: support more options in startup benchmark
1. Add options to benchmark the startup performance of a node
  "instance" after running a script. By default there are two options:
  `test/fixtures/semicolon` which is basically an empty file,
  and `benchmark/fixtures/require-cachable` which require all
  the cachable modules before exiting. This allows us to measure
  the overhead of bootstrap in more scenarios.
2. Add options to benchmark the overhead of spinning
  node through a process and through a worker.

PR-URL: https://github.com/nodejs/node/pull/24220
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
2018-11-14 00:55:37 +01:00

13 lines
248 B
JavaScript

'use strict';
const list = require('internal/bootstrap/cache');
const {
isMainThread
} = require('worker_threads');
for (const key of list.cachableBuiltins) {
if (!isMainThread && key === 'trace_events') {
continue;
}
require(key);
}