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

Function main

benchmark/vm/compile-script-in-isolate-cache.js:16–35  ·  view source on GitHub ↗
({ n, type, filename })

Source from the content-addressed store, hash-verified

14});
15
16function main({ n, type, filename }) {
17 const scriptPath = path.resolve(__dirname, '..', '..', filename);
18 const scriptSource = fs.readFileSync(scriptPath, 'utf8');
19 let script;
20 bench.start();
21 const options = {};
22 switch (type) {
23 case 'with-dynamic-import-callback':
24 // Use a dummy callback for now until we really need to benchmark it.
25 options.importModuleDynamically = async () => {};
26 break;
27 case 'without-dynamic-import-callback':
28 break;
29 }
30 for (let i = 0; i < n; i++) {
31 script = new vm.Script(scriptSource, options);
32 }
33 bench.end(n);
34 script.runInThisContext();
35}

Callers

nothing calls this directly

Calls 5

runInThisContextMethod · 0.80
resolveMethod · 0.45
readFileSyncMethod · 0.45
startMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected