tree: c3b722ee85232e0e9a06ff63a9d6d493651d4b55 [path history] [tgz]
  1. build-aot/
  2. build-interp/
  3. src/
  4. .gitignore
  5. aot.js
  6. benchmark.js
  7. build.log
  8. build.sh
  9. dotnet_sdk_info.txt
  10. interp.js
  11. README.md
wasm/dotnet/README.md

.NET on WebAssembly

Tests .NET on WebAssembly. This benchmark tests operations on .NET implementation of String, JSON serialization, specifics of .NET exceptions and computation of a 3D scene using Mono Interpreter & AOT. Source code: .NET

The Benchmark

Consists of two halves:

  1. BenchTasks, which is a series of micro-benchmarks:

    1. Exception throw/catch.
    2. JSON serialization/deserialization.
    3. String operations.
  2. RayTracer

They run for different iterations/sizes, respectively for each half, depending on the variant (AOT/interpreter). The values to adjust the workloads are passed in from benchmark.js.

Build instructions

Download .NET SDK 9.0.3xx

Run build.sh script. It will install wasm-tools workload & build the benchmark code twice (for Mono interpreter & AOT).

To run the benchmark code on jsc, we are prepending import.meta.url ??= "" to dotnet.js.

Background on .NET / build output files

Mono AOT works in a “mixed mode”. It is not able to compile all code patterns and in various scenarios it falls back to interpreter. Because of that we are still loading managed dlls (all the other not-dotnet.native.wasm files).

Structure of the build output

  • dotnet.js is entrypoint JavaScript with public API.
  • dotnet.runtime.js is internal implementation of JavaScript logic for .NET.
  • dotnet.native.js is emscripten module configured for .NET.
  • dotnet.native.wasm is unmanaged code (Mono runtime + AOT compiled code).
  • System.*.wasm is .NET BCL that has unused code trimmed away.
  • dotnet.wasm is the benchmark code.