NetWasm is an independent toolchain designed to compile C# and .NET Common Intermediate Language (CIL) directly into WebAssembly (Wasm) and WebAssembly System Interface (WASI) components. Unlike standard .NET WebAssembly implementations, NetWasm does not include the desktop Common Language Runtime (CLR), Mono, or large application DLLs in the production artifact. Instead, it uses a 'closed-world' compilation model where the compiler identifies reachable code and links only the specific runtime support required for the application. This approach allows it to produce standalone WASI Preview 2 components that include a built-in runtime and a precise Compact garbage collector.
In a specific benchmark comparing a 'print 42' workload, NetWasm produced a raw Wasm component of 47,895 bytes. This outperformed a Rust 1.95.0 binary compiled with a size-oriented profile, which measured 53,635 bytes. When compressed using Brotli-11, the NetWasm artifact dropped to 13,660 bytes, while the Rust binary remained larger at 16,963 bytes. The project achieves these results by specializing generics, using known contracts for JSON and dependency injection instead of runtime discovery, and excluding broad runtime features like dynamic assembly loading or the 'dynamic' keyword from the profile.
This chart visualizes the specific benchmark results where NetWasm outperformed Rust in both raw and compressed binary sizes.
However, these results represent a specific, measured workload rather than a general language-wide ranking. The NetWasm profile is deliberately restricted; it does not support full system APIs like raw sockets or subprocesses, and it excludes many standard .NET features such as named-culture globalization and managed threading. Furthermore, while NetWasm significantly reduces the footprint compared to standard Blazor WebAssembly—which can exceed 15 megabytes for similar workloads—it remains a specialized platform. The project is currently in a pre-1.0 state, with a roadmap focused on expanding WASI Preview 2 coverage and improving the incremental development loop before reaching a stable 1.0 release.
This figure illustrates the massive reduction in size achieved by NetWasm compared to the standard .NET Blazor WebAssembly implementation.