Article may be outdated

This article is 5 days old. Some details may have changed since publication.

Hacker News·3 min read·hard

C# now beats Rust on WASM size

S
sumnole
C# now beats Rust on WASM size
✦AI Summary

An independent .NET for WebAssembly implementation called NetWasm has demonstrated smaller output sizes than Rust for WebAssembly (WASM) and WASI workloads. By compiling C# directly to WebAssembly with a precise garbage collector and excluding the desktop CLR, NetWasm achieves notable raw and compressed size advantages over a standard Rust toolchain.

Why it matters

Binary size and runtime overhead are critical factors in web and edge deployment efficiency, challenging the long-held assumption that Rust holds an unchallenged lead in minimal WebAssembly footprint.

✦Dive DeeperCreate a free account to unlock

Independent .NET for WebAssembly and WASI. Write C#. Deploy small, standalone Wasm.

NetWasm is an independent compiler, CoreLib, runtime and SDK that compiles C# and .NET CIL directly to WebAssembly. It does not carry the desktop CLR, Mono, dotnet.js or application DLLs into production.

Compile C# to WebAssembly · Try it in the browser · Install and build · See supported APIs · Read the documentation

NetWasm + precise GC: 47,895 bytes Rust 1.95.0 size-oriented profile: 53,635 bytes

For the same print- 42 workload, NetWasm's result includes the runtime and precise Compact garbage collector. Both artifacts are standalone WASI Preview 2 Components, built the way a developer gets them out of the box: each toolchain's standard library and ordinary build, with no hand-added tools.

10.7% smaller raw. 19.5% smaller with Brotli-11.

Continue reading on Headlinne

Create a free account to read the full article.

Read full article →
technologyscience
✦

Get smarter about the news

Sign up free for a feed built around what you actually care about, Dive Deeper research on any story, and the full text of every article.

Create free account

Already have an account? Sign in