Top
Best
New

Posted by jorangreef 11 hours ago

How Our Rust-to-Zig Rewrite Is Going(rtfeldman.com)
360 points | 201 commentspage 3
christkv 6 hours ago||
Can anybody explain to me why anthropic bought bun in the first place ?
3D39739091 2 hours ago||
Nobody can.

"Claude Code uses Bun" is the reason that's given. But even though Anthropic tells us that "coding is solved", instead of rewriting Claude Code in something other than JS, they bought a company that made a JS runtime and then did a mass rewrite of that JS runtime.

steveklabnik 6 hours ago||
Claude Code uses bun.
christkv 4 hours ago||
Yeah I get they use it but I don't understand why you would buy it. it's just the runtime for code that makes up the agent.
steveklabnik 4 hours ago||
Bun was a startup. Startups can go out of business, and then you are now scrambling to move your code to something else. They could also be bought by someone who has different priorities regarding future development than you, and that's also a risk.

The simplest solution to these problems, if you have the capital, is to buy them.

christkv 3 hours ago||
I get that but there is always node.js
steveklabnik 2 hours ago||
They aren't exactly the same thing, moving to node would be possible but bun does more than node, so you need to replace the whole thing.
christkv 2 hours ago||
Oh for sure. I guess its just as much a Acqui-hire as well as for the tech.
up2isomorphism 7 hours ago||
I think there will be soon a wave of rewriting rust to language X coming up.
echelon 5 hours ago|
The other way around.

Rust is also one of the best languages to use with AI.

skhameneh 1 hour ago||
I like Rust and I'm an advocate of Rust, but this really isn't true (at least it hasn't been and I doubt much has significantly changed).

The syntax complexity and the ecosystem haven't been ideal for LLM development. And there have been publications on findings of LLM efficacy with different languages. Rust is most often towards the lower end of efficiency/correctness when benchmarked.

https://arxiv.org/html/2508.09101v1

steveklabnik 1 hour ago||
This paper uses models that are over a year old at this point. Many people didn't believe that LLMs were worth using for programming until 6 months after that, and now again this week we've had another huge leap in abilities.

This is beyond the other issues with the methodology of this study. For example, their Rust code was created by asking Deepseek to port their C++ code, not having it try and write Rust itself.

dminik 6 hours ago||
While I'm a rust enthusiast, I do agree that certain languages lend themselves well to particular domains. So a rewrite from Rust to something better suited is fine by me. In fact, while I do work on a rust project, I would not have and still would not recommend it as the choice for that particular project.

That being said, I had to do some double takes while reading this.

> https://rtfeldman.com/rust-to-zig#memory-safety-post-rewrite

I feel that it's a bit weird to compare a rather well tested 7 (?) year old rust implementation with a brand new not yet released less than a year old Zig implementation. Without that context, this looks like a bad comparison for rust, when it is in fact the complete opposite.

> https://rtfeldman.com/rust-to-zig#build-times

The swiftness of the Zig compilere here is insane, and would would very much shift my recommendation of Rust if it got to similar speeds.

That being said, I do find it funny that currently, the compilation speed is actually worse on Zig than Rust, despite Zig (anonymous commenters at least tbf) claiming the opposite for years.

How did you eventually discover the 35 ms figure for Roc? Did you have to temporarily update the codebase to 0.17?

> https://rtfeldman.com/rust-to-zig#memory-control-zero-parse-...

Nothing negative here. I did play around with implementing a scripting language in this DOD-ish, index-based paradigm and yeah, it is neat.

I was thinking that it might be possible to do resumable computation across the network like this (in the context of frontend frameworks "resuming" UIs), but ultimately I have no use for this so just the experience itself was enough.

One note here is that it does tend to break completely if non-pointer-free data is introduced. It seems like it's either all or nothing.

> https://rtfeldman.com/rust-to-zig#ecosystem-relevance

This is more of an LLVM thing, which is fair, but I find it funny that "LLVM unstable bad" while "Zig unstable whatever".

Overall though, this was an interesting read. And if the folks contributing to roc like zig then more power to them.

Last thing, the link here is broken (points to a TODO):

> Zig's compiler itself is another

andriy_koval 6 hours ago|
> In fact, while I do work on a rust project, I would not have and still would not recommend it as the choice for that particular project.

wondering what type of project is that? I think besides some very embedded projects with very little memory where you need C/assembly, rust is good enough for all kind of projects..

dminik 5 hours ago||
I work both on a pretty much bog-standard web (GraphQL) backend and the frontend that uses it. We switched over from Apollo on node to async-graphql on Rust.

The runtime performance is much better, but the compiler time performance is terrible. To be fair, this is mostly the fault of async-graphql, but that doesn't really matter all that much. For example, it's not uncommon for a single character SQL query change to trigger over a minute long incremental rebuild.

The rust compiler is just choking on the number of generics and codegenned functions.

I've personally looked at how to improve this, but short of breaking up the type graph using federation, nothing can help. Not even cranelift makes a noticeable dent.

Additionally, the team started off composed by a bunch of TypeScript/React/Node developers, so mistakes were made along the way.

Honestly, I would have recommended to just use C#.

That's not to say that I don't think Rust can work for web development. We have some (GraphQL-less) services where Rust is a great fit. Just maybe shouldn't have been the default. That or give up graphql ...

steveklabnik 5 hours ago||
For whatever it's worth, I share some of your async-graphql woes, though I haven't investigated things deeply enough to have strong opinions about what to do instead.
kyo5uke 1 hour ago||
[dead]
nntlol 8 hours ago||
[dead]
kotberg 3 hours ago||
[dead]
throwaway613746 8 hours ago||
[dead]
jdw64 7 hours ago||
[dead]
baerbelblue 4 hours ago|
[dead]
More comments...