# C# now compiles to smaller Wasm than Rust

Original title: C# now beats Rust on WASM size

> Hacker News story 50175510 · language: en · submitted 2026-10-21
> Web version: https://zeli.app/story/50175510
> About this feed: https://zeli.app/llms.txt · Agent guide: https://zeli.app/skill.md

▲ 160 · by [sumnole](<https://news.ycombinator.com/user?id=sumnole>) · 💬 108
[original](<https://github.com/zion-sati/NetWasm>) · [HN discussion](<https://news.ycombinator.com/item?id=50175510>)

## Summary

NetWasm, an independent compiler that turns C# and .NET CIL directly into standalone WebAssembly, produces a 47,798-byte WASI Preview 2 component for a print-42 workload, including its runtime and precise garbage collector. Rust 1.95.0 with a size-oriented profile comes in at 53,635 bytes. The project also reports beating Mono AOT on allocation and GC benchmarks and being roughly 320 times smaller than a Blazor WebAssembly build.

## Key quote

> This is a new .NET platform, not desktop .NET squeezed into a Wasm sandbox. That boundary is what makes native-Wasm-sized C# possible.

## HN discussion (108 comments)

### [sondr3](<https://news.ycombinator.com/item?id=50177223>)

> It's a bit of an unfair comparison, the benchmarked C# code here is also post-processed which none of the other targets are. See this comment[1] on reddit where the author announced this on the /r/dotnet subreddit, Rust can go much, much lower. The title is misleading at best and a lie at worst, this is great but saying it beats Rust is a far cry from the truth except for the very narrow benchmark made to showcase this tool.
>
> [1]: https://www.reddit.com/r/dotnet/comments/1x7wsgb/rust_just_l...

### [CharlieDigital](<https://news.ycombinator.com/item?id=50178277>)

> There's something about C# that just feels so right for me for backends (as long as you stick to the more modern conventions).
>
> Good tooling, modern language features (C# 15 has the long awaited unions, closed hierarchies), great debugging experience, etc.

### [TazeTSchnitzel](<https://news.ycombinator.com/item?id=50178407>)

> \> The 46.7 KiB program is the baseline, not the boundary.
>
> what does this even mean

### [subset](<https://news.ycombinator.com/item?id=50187937>)

> Shoutout to the [wasm-bindgen](https://github.com/wasm-bindgen/wasm-bindgen) maintainers who do an awesome job of allowing Rust to be compiled to WASM smoothly. I built an [eigenvalue solver](https://abstractnonsense.xyz/blog/2025-12-31-eigenvalue-solv...) in Rust for an interactive component for my blog, and it was super smooth going. Felt like magic! I've noticed that the binary sizes can blow up a bit by including libraries, but if you're careful I think the binaries are pretty small, tbh.

### [Scaled](<https://news.ycombinator.com/item?id=50178268>)

> Worth pointing out this is not open source, if that is an important consideration when you're comparing the two (it is to me).

### [weinzierl](<https://news.ycombinator.com/item?id=50177115>)

> This is s bit of an unfair comparison, isn't it?
>
> Since WASM ships with a garbage collector that C# can use while Rust does all the memory management itself, of course it will be bigger.
>
> EDIT: Reading OP more thoroughly I think I'm wrong. Apparently in the compared versions, the C# version ships a runtime with garbage collector.

### [gwbas1c](<https://news.ycombinator.com/item?id=50180576>)

> I'm trying to understand the UI story here: From what I understand, it doesn't have Blazor or anything similar.
>
> Is this intended primarily for offloading CPU-intense calculations, or sharing code with a C# backend?
>
> Otherwise, what's the intended story for UI? Do all that in JavaScript?

### [andsoitis](<https://news.ycombinator.com/item?id=50175527>)

> this looks phenomenal. Can't wait to try it out.

---

## Cite

- Page: https://zeli.app/story/50175510
- Date: 2026-10-21
- Source: github.com (https://github.com/zion-sati/NetWasm)
- Hacker News: https://news.ycombinator.com/item?id=50175510

## Other languages

- zh: https://zeli.app/zh/story/50175510 · markdown: https://zeli.app/zh/story/50175510.md
- ja: https://zeli.app/ja/story/50175510 · markdown: https://zeli.app/ja/story/50175510.md
- ko: https://zeli.app/ko/story/50175510 · markdown: https://zeli.app/ko/story/50175510.md
- de: https://zeli.app/de/story/50175510 · markdown: https://zeli.app/de/story/50175510.md
- es: https://zeli.app/es/story/50175510 · markdown: https://zeli.app/es/story/50175510.md
- ru: https://zeli.app/ru/story/50175510 · markdown: https://zeli.app/ru/story/50175510.md
