Skip to content

Commit 777c2c0

Browse files
committed
dotnet: move the Wasm compilation into the first run
1 parent 3900fef commit 777c2c0

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

wasm/dotnet/benchmark.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
class Benchmark {
22
async init() {
3-
const config = {
3+
this.config = {
44
mainAssemblyName: "dotnet.dll",
55
globalizationMode: "custom",
66
assets: [
@@ -123,10 +123,7 @@ class Benchmark {
123123
}
124124
]
125125
};
126-
127126
this.dotnet = (await JetStream.dynamicImport(JetStream.preload.dotnetUrl)).dotnet;
128-
this.api = await this.dotnet.withModuleConfig({ locateFile: e => e }).withConfig(config).create();
129-
this.exports = await this.api.getAssemblyExports("dotnet.dll");
130127

131128
// This drives the workload size for BenchTasks half of the test.
132129
this.benchTasksBatchSize = dotnetFlavor === "aot" ? 50 : 10;
@@ -137,6 +134,11 @@ class Benchmark {
137134
this.sceneHeight = dotnetFlavor === "aot" ? 100 : 50;
138135
}
139136
async runIteration() {
137+
if (!this.exports) {
138+
const api = await this.dotnet.withModuleConfig({ locateFile: e => e }).withConfig(this.config).create();
139+
this.exports = await api.getAssemblyExports("dotnet.dll");
140+
}
141+
140142
await this.exports.Interop.RunIteration(this.benchTasksBatchSize, this.sceneWidth, this.sceneHeight, this.hardwareConcurrency);
141143
}
142144
}

0 commit comments

Comments
 (0)