summaryrefslogtreecommitdiff
path: root/benchmark/fixtures
diff options
context:
space:
mode:
authorJoyee Cheung <joyeec9h3@gmail.com>2018-11-07 04:28:50 +0800
committerRich Trott <rtrott@gmail.com>2018-11-09 15:55:19 -0800
commit1698fc96af2d58dce414cd22b7d9898f30efde3e (patch)
tree3e105e613ae8da2ee1335d94d646dae4cd1be6fc /benchmark/fixtures
parent5e1bf058f4906c0a49c34c6a1353d0b34784c80a (diff)
downloadandroid-node-v8-1698fc96af2d58dce414cd22b7d9898f30efde3e.tar.gz
android-node-v8-1698fc96af2d58dce414cd22b7d9898f30efde3e.tar.bz2
android-node-v8-1698fc96af2d58dce414cd22b7d9898f30efde3e.zip
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>
Diffstat (limited to 'benchmark/fixtures')
-rw-r--r--benchmark/fixtures/require-cachable.js13
1 files changed, 13 insertions, 0 deletions
diff --git a/benchmark/fixtures/require-cachable.js b/benchmark/fixtures/require-cachable.js
new file mode 100644
index 0000000000..f651728dc7
--- /dev/null
+++ b/benchmark/fixtures/require-cachable.js
@@ -0,0 +1,13 @@
+'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);
+}