Skip to content

Commit

Permalink
appstart benchmark improvements (#74799)
Browse files Browse the repository at this point in the history
appstart benchmark improvements
  • Loading branch information
pavelsavara authored Aug 31, 2022
1 parent d48dd6c commit b82f254
Show file tree
Hide file tree
Showing 8 changed files with 25 additions and 5 deletions.
4 changes: 4 additions & 0 deletions src/mono/sample/wasm/browser-advanced/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="modulepreload" href="./main.js" />
<link rel="modulepreload" href="./dotnet.js" />
<link rel="preload" href="./mono-config.json" as="fetch" crossorigin="anonymous">
<link rel="preload" href="./dotnet.wasm" as="fetch" crossorigin="anonymous">
<link rel="preload" href="./icudt.dat" as="fetch" crossorigin="anonymous">
<link rel="preload" href="./managed/System.Private.CoreLib.dll" as="fetch" crossorigin="anonymous">
</head>

<body>
Expand Down
1 change: 0 additions & 1 deletion src/mono/sample/wasm/browser-advanced/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ try {
console.debug(`meaning: ${meaning}`);
if (!exports.Sample.Test.IsPrime(meaning)) {
document.getElementById("out").innerHTML = `${meaning} as computed on dotnet ver ${runtimeBuildInfo.productVersion}`;
console.debug(`ret: ${meaning}`);
}

let exit_code = await runMain(config.mainAssemblyName, []);
Expand Down
1 change: 1 addition & 0 deletions src/mono/sample/wasm/browser-bench/AppStart.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

namespace Sample
{
// http://localhost:8000/?task=AppStart
public partial class AppStartTask : BenchTask
{
public override string Name => "AppStart";
Expand Down
8 changes: 6 additions & 2 deletions src/mono/sample/wasm/browser-bench/appstart-frame.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,12 @@
<title>App task</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="modulepreload" href="frame-main.js" />
<link rel="modulepreload" href="dotnet.js" />
<link rel="modulepreload" href="./frame-main.js" />
<link rel="modulepreload" href="./dotnet.js" />
<link rel="preload" href="./mono-config.json" as="fetch" crossorigin="anonymous">
<link rel="preload" href="./dotnet.wasm" as="fetch" crossorigin="anonymous">
<link rel="preload" href="./icudt.dat" as="fetch" crossorigin="anonymous">
<link rel="preload" href="./managed/System.Private.CoreLib.dll" as="fetch" crossorigin="anonymous">
</head>

<body>
Expand Down
4 changes: 2 additions & 2 deletions src/mono/sample/wasm/browser-bench/frame-main.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ try {
}

const runtime = await dotnet
.withElementOnExit()
.withExitCodeLogging()
.withModuleConfig({
printErr: () => undefined,
print: () => undefined,
onConfigLoaded: (config) => {
if (window.parent != window) {
window.parent.resolveAppStartEvent("onConfigLoaded");
Expand Down
6 changes: 6 additions & 0 deletions src/mono/sample/wasm/browser-bench/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="style.css">
<link rel="modulepreload" href="./main.js" />
<link rel="modulepreload" href="./dotnet.js" />
<link rel="preload" href="./mono-config.json" as="fetch" crossorigin="anonymous">
<link rel="preload" href="./dotnet.wasm" as="fetch" crossorigin="anonymous">
<link rel="preload" href="./icudt.dat" as="fetch" crossorigin="anonymous">
<link rel="preload" href="./managed/System.Private.CoreLib.dll" as="fetch" crossorigin="anonymous">
</head>

<body>
Expand Down
4 changes: 4 additions & 0 deletions src/mono/sample/wasm/browser/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="modulepreload" href="./main.js" />
<link rel="modulepreload" href="./dotnet.js" />
<link rel="preload" href="./mono-config.json" as="fetch" crossorigin="anonymous">
<link rel="preload" href="./dotnet.wasm" as="fetch" crossorigin="anonymous">
<link rel="preload" href="./icudt.dat" as="fetch" crossorigin="anonymous">
<link rel="preload" href="./managed/System.Private.CoreLib.dll" as="fetch" crossorigin="anonymous">
</head>

<body>
Expand Down
2 changes: 2 additions & 0 deletions src/mono/sample/wasm/simple-server/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,8 @@ private async void ServeAsync(HttpListenerContext context)
string? contentType = null;
if (path.EndsWith(".wasm"))
contentType = "application/wasm";
if (path.EndsWith(".json"))
contentType = "application/json";
if (path.EndsWith(".js") || path.EndsWith(".mjs") || path.EndsWith(".cjs"))
contentType = "text/javascript";

Expand Down

0 comments on commit b82f254

Please sign in to comment.