Skip to content

Commit 96283ce

Browse files
kgmatouskozak
authored andcommitted
[wasm] Disable interp pgo recording by default since it adds startup overhead (dotnet#101566)
* Disable interp pgo recording by default since it adds startup overhead * Make withRuntimeOptions not trample existing runtime options
1 parent 4a62150 commit 96283ce

File tree

4 files changed

+12
-12
lines changed

4 files changed

+12
-12
lines changed

src/mono/browser/runtime/loader/run.ts

+8-3
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,10 @@ export class HostBuilder implements DotnetHostBuilder {
158158
interpreterPgo: value,
159159
interpreterPgoSaveDelay: autoSaveDelay
160160
});
161+
if (monoConfig.runtimeOptions)
162+
monoConfig.runtimeOptions.push("--interp-pgo-recording");
163+
else
164+
monoConfig.runtimeOptions = ["--interp-pgo-recording"];
161165
return this;
162166
} catch (err) {
163167
mono_exit(1, err);
@@ -268,9 +272,10 @@ export class HostBuilder implements DotnetHostBuilder {
268272
withRuntimeOptions (runtimeOptions: string[]): DotnetHostBuilder {
269273
try {
270274
mono_assert(runtimeOptions && Array.isArray(runtimeOptions), "must be array of strings");
271-
deep_merge_config(monoConfig, {
272-
runtimeOptions
273-
});
275+
if (monoConfig.runtimeOptions)
276+
monoConfig.runtimeOptions.push(...runtimeOptions);
277+
else
278+
monoConfig.runtimeOptions = runtimeOptions;
274279
return this;
275280
} catch (err) {
276281
mono_exit(1, err);

src/mono/mono/utils/options-def.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ DEFINE_BOOL(wasm_exceptions, "wasm-exceptions", FALSE, "Enable codegen for WASM
6161
DEFINE_BOOL(aot_lazy_assembly_load, "aot-lazy-assembly-load", FALSE, "Load assemblies referenced by AOT images lazily")
6262

6363
#if HOST_BROWSER
64-
DEFINE_BOOL(interp_pgo_recording, "interp-pgo-recording", TRUE, "Record interpreter tiering information for automatic PGO")
64+
DEFINE_BOOL(interp_pgo_recording, "interp-pgo-recording", FALSE, "Record interpreter tiering information for automatic PGO")
6565
#else
6666
DEFINE_BOOL(interp_pgo_recording, "interp-pgo-recording", FALSE, "Record interpreter tiering information for automatic PGO")
6767
DEFINE_BOOL(wasm_gc_safepoints, "wasm-gc-safepoints", FALSE, "Use GC safepoints on WASM")

src/mono/sample/wasm/browser-bench/main.js

-5
Original file line numberDiff line numberDiff line change
@@ -225,11 +225,6 @@ try {
225225
// console to see statistics on how much code it generated and whether any new opcodes
226226
// are causing traces to fail to compile
227227
.withRuntimeOptions(["--jiterpreter-stats-enabled"])
228-
// We enable interpreter PGO so that you can exercise it in local tests, i.e.
229-
// run browser-bench one, then refresh the tab to measure the performance improvement
230-
// on the second run of browser-bench. The overall speed of the benchmarks won't
231-
// improve much, but the time spent generating code during the run will go down
232-
.withInterpreterPgo(true, 30)
233228
.withElementOnExit()
234229
.withExitCodeLogging()
235230
.create();

src/mono/wasm/testassets/WasmBasicTestApp/App/wwwroot/main.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ switch (testCase) {
3737
let alreadyFailed = [];
3838
dotnet.withDiagnosticTracing(true).withResourceLoader((type, name, defaultUri, integrity, behavior) => {
3939
if (type === "dotnetjs") {
40-
// loadBootResource could return string with unqualified name of resource.
40+
// loadBootResource could return string with unqualified name of resource.
4141
// It assumes that we resolve it with document.baseURI
4242
// we test it here
4343
return `_framework/${name}`;
@@ -131,8 +131,8 @@ try {
131131
}
132132
});
133133
const iterationCount = params.get("iterationCount") ?? 70;
134-
for (let i = 0; i < iterationCount; i++) {
135-
exports.InterpPgoTest.Greeting();
134+
for (let i = 0; i < iterationCount; i++) {
135+
exports.InterpPgoTest.Greeting();
136136
};
137137
await INTERNAL.interp_pgo_save_data();
138138
exit(0);

0 commit comments

Comments
 (0)