perf: static bootstrap options in snapshot (#21213)

Closes https://github.com/denoland/deno/issues/21133
This commit is contained in:
Divy Srivastava 2023-11-15 04:25:55 -08:00 committed by GitHub
parent c67de43ff3
commit 7f3902b41f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 66 additions and 47 deletions

View file

@ -450,6 +450,13 @@ const finalDenoNs = {
...denoNs,
};
const {
denoVersion,
tsVersion,
v8Version,
target,
} = ops.op_snapshot_options();
function bootstrapMainRuntime(runtimeOptions) {
if (hasBootstrapped) {
throw new Error("Worker runtime already bootstrapped");
@ -457,16 +464,12 @@ function bootstrapMainRuntime(runtimeOptions) {
const nodeBootstrap = globalThis.nodeBootstrap;
const {
0: denoVersion,
1: location_,
2: tsVersion,
3: unstableFlag,
4: unstableFeatures,
5: target,
6: v8Version,
7: inspectFlag,
9: hasNodeModulesDir,
10: maybeBinaryNpmCommandName,
0: location_,
1: unstableFlag,
2: unstableFeatures,
3: inspectFlag,
5: hasNodeModulesDir,
6: maybeBinaryNpmCommandName,
} = runtimeOptions;
performance.setTimeOrigin(DateNow());
@ -583,16 +586,12 @@ function bootstrapWorkerRuntime(
const nodeBootstrap = globalThis.nodeBootstrap;
const {
0: denoVersion,
1: location_,
2: tsVersion,
3: unstableFlag,
4: unstableFeatures,
5: target,
6: v8Version,
8: enableTestingFeaturesFlag,
9: hasNodeModulesDir,
10: maybeBinaryNpmCommandName,
0: location_,
1: unstableFlag,
2: unstableFeatures,
4: enableTestingFeaturesFlag,
5: hasNodeModulesDir,
6: maybeBinaryNpmCommandName,
} = runtimeOptions;
performance.setTimeOrigin(DateNow());