forked from nodejs/node
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge commit '1d526a47af29d59ad196c4e05606b0ec6f8090d9' into v18.20.2
- Loading branch information
Showing
1,349 changed files
with
140,603 additions
and
160,514 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
'use strict'; | ||
|
||
// This benchmarks compiling scripts that hit the in-isolate compilation | ||
// cache (by having the same source). | ||
const common = require('../common.js'); | ||
const fs = require('fs'); | ||
const vm = require('vm'); | ||
const fixtures = require('../../test/common/fixtures.js'); | ||
const scriptPath = fixtures.path('snapshot', 'typescript.js'); | ||
|
||
const bench = common.createBenchmark(main, { | ||
type: ['with-dynamic-import-callback', 'without-dynamic-import-callback'], | ||
n: [100], | ||
}); | ||
|
||
const scriptSource = fs.readFileSync(scriptPath, 'utf8'); | ||
|
||
function main({ n, type }) { | ||
let script; | ||
bench.start(); | ||
const options = {}; | ||
switch (type) { | ||
case 'with-dynamic-import-callback': | ||
// Use a dummy callback for now until we really need to benchmark it. | ||
options.importModuleDynamically = async () => {}; | ||
break; | ||
case 'without-dynamic-import-callback': | ||
break; | ||
} | ||
for (let i = 0; i < n; i++) { | ||
script = new vm.Script(scriptSource, options); | ||
} | ||
bench.end(n); | ||
script.runInThisContext(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.