-
Notifications
You must be signed in to change notification settings - Fork 16
Add .NET on WebAssembly workload #73
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
✅ Deploy Preview for webkit-jetstream-preview ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
@maraf Thanks for this! A couple of questions:
I think we should probably reduce the number or combine some of these tests so that we're not weighting dotnet too heavily. Right now there are 8 added, which makes it 8 times more important than any other wasm test. I think we've talked about having experimental tests that are not in the main score by default, we could potentially do that here. |
@eqrion Thank you for feedback!
|
I have combined all the tests to single benchmark. We still have two flavors (interpreter & aot) since those can't be combined together. I have reduced the iterations we do to reduce time to run the benchmark |
Here are the new times that I've observed.
Using https://deploy-preview-73--webkit-jetstream-preview.netlify.app/ |
Running in shells (e.g., via |
@maraf and @issackjohn I left a first round of comments (sorry for the late look). Overall, very happy to have another source language/toolchain combination, thanks for the contribution! :) See the comments above for more detailed issues. Once it runs in shells (d8, jsc, js), I'll take another look at a CPU profile/flamegraph, compiler tiering behavior etc. |
@danleh Thank you! I have updated the benchmark for work without preloading which seems to be implemented only for browser case.
|
Measurements after scene size reduction for interpreter
|
New times for me.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(Oops, I had those comments already typed out but didn't hit submit, sorry! 🙈)
Mostly clarification questions, minor suggestions. Could you please take a look @maraf @issackjohn ?
I also briefly looked at the flamegraphs/CPU profiles of the current state of the workloads, but it's hard to dig deeper since we don't have debug info/source names for the Wasm functions. @maraf Is there some way with Blazor to generate some form of function name map off-to-the-side (similar to Line 22 in 9163dcb
|
Yes, I'll include symbols |
Looks like this fails in the SM and JSC shells on my machine. Although it seems like they fail for different reasons: SM fails since it's missing
|
We have an unguarded use of Anyway, for unknown reason running dotnet-aot on jsc sometimes fails with cryptic
|
Thanks for the changes! Regarding the jsc failure: IIUC, you manually patched
If this patch becomes too large (because |
I have added a command to prepend it to dotnet.js to build.sh |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the changes, LGTM now :)
Friendly ping @eqrion and @kmiller68 for feedback from the Mozilla/Apple side.
Overall, this looks good to me now. Thanks for the contribution!
That should be fixed now in the latest SM nightly.
Where are these symbols being generated? I don't see anything in the wasm name section for dotnet.native.wasm, nor any names in profiles (which would use the name section). |
|
Oh interesting. Is this an emscripten or blazor generated file? I've not seen this before, I only really knew of the wasm name section. |
It is generated by emscripten |
https://bugs.webkit.org/show_bug.cgi?id=296132 rdar://156071047 Reviewed by NOBODY (OOPS!). This patch adds import.meta.url to the JSC CLI and API module import.meta objects. This matches the web's behavior and is desired for WebKit/JetStream#73.
https://bugs.webkit.org/show_bug.cgi?id=296132 rdar://156071047 Reviewed by NOBODY (OOPS!). This patch adds import.meta.url to the JSC CLI and API module import.meta objects. This matches the web's behavior and is desired for WebKit/JetStream#73.
For the future. Although modules are keyed with a URL so this will end up being a |
Yeah, AFAIK, none of the wasm tests emit a name section and just emit the symbol map. Since most apps don't ship with the name section we figured it was a bit more realistic to have it on the side, even if a bit inconvenient. |
I wasn't aware that was a thing. TIL
Ah, I had been seeing function names in the Dart and Kotlin subtests. I don't see them in argon2-wasm, and so I'm guessing all the emscripten one's don't have the name section. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall LGTM, two main thoughts:
- Is there a reason .NET doesn't forward to the browser's JS internationalization and instead provides your own ICU data?
- If we wanted to fiddle numbers around to e.g. add more iterations or reduce the total runtime of these line items, which numbers are the most/least important for the validity of the benchmark overall?
https://bugs.webkit.org/show_bug.cgi?id=296132 rdar://156071047 Reviewed by Yusuke Suzuki. This patch adds import.meta.url to the JSC CLI and API module import.meta objects. This matches the web's behavior and is desired for WebKit/JetStream#73. Canonical link: https://commits.webkit.org/297565@main
It's simple as JavaScript API doesn't cover all the APIs .NET have. For some time we have been experimenting with hybrid approach, but the download size savings weren't worth it. .NET is using ICU for other platforms and so reusing it for wasm was easy.
|
Thank you all for feedback! |
Add benchmarks for .NET runtime on WebAssembly.
This PR adds 2 benchmarks that test characteristic WebAssembly code for .NET. Benchmarks don't contain UI manipulations and javascript interop except for the necessary startup.
Flavors
There are two flavors of the same benchmark code.
1. Interpreter
The default mode for running .NET (Mono runtime) on WebAssembly is using an interpreter. In this mode .NET assemblies are loaded into WebAssembly memory and IL interpreter interprets the code in a loop.
2. AOT
The second mode Mono runtime on WebAssembly operates in is mixed AOT. It is a mixture of AOTed code and fallbacks to interpreter for scenarios that are not supported by the AOT compiler.
Code samples
These code samples are combined into a single test for each .NET flavor.
RayTracer
Source code at https://github.com/pavelsavara/dotnet-wasm-raytracer. It computes a 3D scene in memory. It is a computation heavy algorithm that stretches the performance of interpreter loop. The UI update part is removed.
Exception handling
.NET uses a two-phase exception handling that is built on top of WasmExceptionHandling.
String
Very common and often used type in .NET codebase.
JSON serialization & deserialization
Very common and often used types in .NET codebase.
Fixes dotnet/runtime#109953