logoalt Hacker News

C# now beats Rust on WASM size

99 points • by sumnole • today at 2:53 AM • 42 comments • view on HN

Comments

sondr3 • today at 7:28 AM

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...

➕ show 3 replies
CharlieDigital • today at 9:56 AM

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.

➕ show 1 reply
TazeTSchnitzel • today at 10:07 AM

> The 46.7 KiB program is the baseline, not the boundary.

what does this even mean

➕ show 2 replies
VimEscapeArtist • today at 12:04 PM

C# will slowly fade in relevance. Nowadays it gets picked mainly when the company already has a lot of .NET in place.

➕ show 1 reply
Scaled • today at 9:56 AM

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 • today at 7:11 AM

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.

➕ show 1 reply
dev_l1x_be • today at 9:55 AM

X is better than Y where Y is irrelevant and the difference is marginal is a low relevance observation.

andsoitis • today at 2:55 AM

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

jedisct1 • today at 8:41 AM

Not very hard... Rust wasm binaries are ginormous.

If you care about WASM performance, size and memory usage, Zig is a much better candidate.

➕ show 1 reply
sagacity • today at 7:59 AM

[dead]

WhereIsTheTruth • today at 10:15 AM

Of course, they lobbied to transfer the bloat onto the WASM runtime itself

bob1029 • today at 8:13 AM

I never understood the appeal of wasm outside special performance cases. We never once considered moving from Blazor server side to the wasm mode. Not one time in 5+ years did it ever come up. The whole idea turned out to be a huge distracting waste of engineering talent. Instead of chasing this idealistic wasm pipeline and struggling with weird websocket transports, we could have been writing boring old cshtml and JavaScript on top of stateless HTTP.

Unless you are building a web version of autocad or premiere, I don't see the point of engaging with this technology.

➕ show 3 replies
edave64 • today at 12:19 PM

Maybe I'm ignorant of some fundamental limitation here, but I cannot get excited for 47kB for a `print(42)`.