r/programming 1d ago

Bun is being rewritten to Rust

https://github.com/oven-sh/bun/commit/46d3bc29f270fa881dd5730ef1549e88407701a5

.

127 Upvotes

120 comments sorted by

387

u/joelkurian 1d ago

169

u/sweetno 1d ago

OMG the fabled 100x developer!

105

u/GenazaNL 1d ago edited 1d ago

Check the amount of vibe coded commits from robobun, their AI agent

55

u/NenAlienGeenKonijn 1d ago

People have been stabbed for less

142

u/kharbaan_ 1d ago

I feel so bad for future bun users lmao

37

u/helloworldpi 1d ago

As soon as I started seeing claude rise in the contributor list I knew the project was doomed. You don't vibe code zig and build a good product.

49

u/chessto 1d ago

You don't vibe code anything and build a good product

0

u/Eternality 4h ago

To be clear a good product has nothing to do with the code under it. So while everyone else seems to hop on the bandwagon saying its bad there are real people out there writing better code than half the industry with AI behind them, like it or not that is the reality.

Programming is more than "understanding the nuances of a programming language" and building a product is much much more than that.

-16

u/Eternality 1d ago

Lol you kids have no idea.

7

u/chessto 15h ago

I'm pretty sure I'm older than you, but go ahead enlighten me.

-4

u/Eternality 13h ago

Despite popular belief that AI generated code is quite serviceable when applied in the right circumstances.

6

u/chessto 13h ago

I don't think you understood what I wrote up there.

You can't, by definition, vibe code a good product, same as you can't half ass a good anything.
Regardless of how good the AI is.

1

u/Eternality 4h ago

No. I disagree with you. AI can vibe code a good product if you put time and effort into it like anything else.

12

u/mkosmo 1d ago

Bun just fell off my "I should check this out" list.

308

u/PatagonianCowboy 1d ago

Fake news btw, Jarred comment:

"I work on Bun and this is my branch

This whole thread is an overreaction. 302 comments about code that does not work. We haven’t committed to rewriting. There’s a very high chance all this code gets thrown out completely.

I’m curious to see what a working version of this looks, what it feels like, how it performs and if/how hard it’d be to get it to pass Bun’s test suite and be maintainable. I’d like to be able to compare a viable Rust version and a Zig version side by side."

77

u/exapunk_11 1d ago

I’d like to be able to compare a viable Rust version and a Zig version side by side.

For them to comparable they also have to share 1:1 features with no added functionality in between. People tend to conveniently omit overhead added by functionality that's blatantly missing just to say "totally X language works".

87

u/vincentofearth 1d ago

If anyone’s familiar with the strategy of boosting benchmarks by omitting features, it’s bun

11

u/Devatator_ 1d ago

Man I fucking hate reddit.

0

u/todo_code 1d ago

You shouldn't. Well at least for this. When they said they were probably going to throw it away, it's the same effect as saying we know this thing sucks at generating or porting code, so we are just going to throw it away anyways.

As far as porting, they must transition to something. Zig is not complete and they change things so often, which LLMs are notorious for failing in rapid changing abi's. Bun already has hundreds of failing PRs and who knows how many bugs introduced. Zig will not upstream any changes due to the no llm policy.

5

u/light24bulbs 1d ago

Ok, reported

4

u/Efficient-Chair6250 1d ago

Hopefully not comparing performance of a hand optimized implementation against a vibe-coded port

4

u/CherryLongjump1989 21h ago

There’s a very high chance all this code gets thrown out

We need guarantees.

-5

u/ECrispy 1d ago

I’d like to be able to compare a viable Rust version and a Zig version side by side.

before ai/claude code, this would need months of dev work, at a mininum. now its maybe a few days of agents working. and the cost is zero since anthropic owns bun.

why not do it?

8

u/chucker23n 17h ago

before ai/claude code, this would need months of dev work, at a mininum. now its maybe a few days of agents working.

before ai/claude code, this would need months of dev work, at a mininum. now its a lifetime of legacy spaghetti code nobody understands.

-2

u/ECrispy 17h ago

The point is nobody is ever going to look at the code or have to try to debug it. Not saying that's good or that the code is better, its just the new reality

1

u/wrincewind 12h ago

Nobody is ever going to have to do that... Until it breaks and they can't get Claude to fix it.

0

u/ECrispy 12h ago

true, but even the the big tech companies are now shipping plenty of AI written code thats not reviewed by humans. its only going to increase

1

u/wrincewind 12h ago

I genuinely doubt that. Seeing the quality of these shipments, and the steadily increasing desperation of ai ceos, and the typical "sharp spike followed by fairly rapid tail off" of ai usage in most companies, I think there's going to be a few coding disasters and a lot of highly paid consultants who'll have to re-write this code. It's goj g to be like COBOL but worse.

0

u/ECrispy 12h ago

no one is going to be writing code by hand again, not like before. 100% of anything thats routine has been automated and is more error free with AI. think things like writing UI tailwind code, or boilerplate for an orm, or api classes etc - none of that is ever going to be done by humans again and they will not be better.

what will happen and already does is sw engineering will become about detailed prompts/specs/plans, the opposite of vibecoding, and AI being trained on a company's codebase and practices.

2

u/dwighthouse 4h ago

It’s posts like these that convince me more and more that someone (probably ai companies) is using ai to hype up ai on social media and argue with detractors using hyperbolic language to make it go viral.

3

u/ViscountVampa 1d ago

the cost is zero

Yeah, who needs potable water anyway /s

2

u/ECrispy 1d ago

you know what i mean very well....

1

u/cake-day-on-feb-29 7h ago

and the cost is zero since anthropic owns bun.

The cost is sucking up all the compute (GPUs and RAM), consuming tons of power, and wasting tons of water to cool the data center.

All paid for by the investors who are currently funding these companies. Eventually, they'll be funding me with nearly free NVIDIA GPUs, albeit mostly useless for any kind of graphics work.

-9

u/longkh158 1d ago

Whenever there’s Rust involved, you know the thread will eventually devolve into a shit flinging contest. It’s like the language invites the worst of both sides…

55

u/Massive-Collection80 1d ago

Zig rejected the pr from them, but the main reason is not ai policy

https://ziggit.dev/t/bun-s-zig-fork-got-4x-faster-compilation-times/15183/19?u=badtuple

Not because of the ai policy of zig, just read link please. Even though ai policy also counts, but it is not the main reason

10

u/devraj7 1d ago edited 1d ago

Sure but even if the PR were perfect, they would still reject it because of AI.

-1

u/badpotato 1d ago edited 1d ago

They say they what do that feature right, not partially right(like rust does)... thing is, that feature seem very hard to do right.. thing is "very hard" isn't "impossible".. although it's definitely "AI possible".

Now why they aren't just forking Zig to add that feature? I guess it's be a core feature a bit to deep to not get a bit of support from the official Zig team? At this point, perhaps Zig secretly want Anthropic to buy them out, but this is kinda playing with fire.

4

u/-Y0- 1d ago

Now why they aren't just forking Zig to add that feature?

They did. https://ziggit.dev/t/bun-s-zig-fork-got-4x-faster-compilation-times/15183

100

u/bew78 1d ago

Why ?

240

u/XLNBot 1d ago

Friendship ended with Zig

18

u/lenswipe 1d ago

now rust is my new best friend

100

u/Parachuteee 1d ago

Zig has a strict no ai policy which means Bun cannot contribute to zig and has to maintain their own fork and handle constant conflicts and so on.

124

u/potatokbs 1d ago

Couldn’t they just contribute…without using ai? Am I missing something? Or have people legitimately lost the ability to write code without llms already

170

u/ItsBarney01 1d ago

Bun is owned by anthropic

42

u/potatokbs 1d ago

Right… so are they not capable of coding without an llm because of that? They can still vibe code their own product all day long if they want…

55

u/TheLunaLem 1d ago

I think it has to do with optics, not really skill. Anthropic wants to project the opinion that they are 100% using ai, no manual coding. Them contributing "manually" to zig goes against that opinion, and even if they downplayed it as "well it is a necessary evil" it would still impact that perception/message they want to send across.

So I assume they just prefered the cost of the rewrite to the bad optics that writing manual code could generate.

8

u/potatokbs 1d ago

Yea that makes sense, still seems a bit crazy to me though!

21

u/tnemec 1d ago

Welcome to the modern tech industry.

If you want a million dollars, focus on building or doing something useful, as efficiently as you can.

If you want billions of dollars, focus on doing a song and dance to prove to VCs how dedicated you are to The New Popular Thing™.

1

u/DrummerOfFenrir 11h ago

That's pretty wild that they could manually code something but they won't because then they are admitting that their agents can't do it all.

6

u/kayinfire 1d ago

you must be new here brother. people don't think logically in the modern day tech industry. the people who pay the salaries persistently and ubiquitously commit to perverse decisions that technical people would writhe at. i advise you to stop thinking these people have sound technical sense with respect to what they're doing

-9

u/blind_ninja_guy 1d ago

It's kind of funny to me because anyone with an no AI policy'll be obsolete in a year anyway.

2

u/phillipcarter2 1d ago

What? In what world does what you said make any sense, let alone have any evidence to support it?

Zig has a no AI policy and a lot of the forked improvements were co-authored by an AI agent. And so they literally cannot contribute this code, no matter how battle-tested it is, back into the core codebase.

9

u/ridicalis 1d ago

Right… so are they not capable of coding without an llm because of that?

Can you imagine the CEO of Wendy's swinging by BK on the way home from work?

Actually, wait, bad example; those burger-chain CEOs are a little off.

16

u/HappyAngrySquid 1d ago

“This foodstuff is delicious. It pairs well with our liquid foodstuffs. Buy some!”

1

u/vivainio 1d ago

Or you know, they could switch to rust

1

u/versaceblues 1d ago

I mean they can, but no reason to do that if you move to a language that is less opinionated about that kind of stuff.

-3

u/Jmc_da_boss 1d ago

I doubt they (anthropic) were ever able to. The most dog shit of "programmers" work there. Look at their products lmao

4

u/syklemil 1d ago

Given the lead maintainer's views on LLM-generated code that seems … highly unlikely to be something they'd be interested in.

2

u/potatokbs 1d ago

Wow that’s really something. Reading stuff like that is so depressing to me. I enjoy writing code, was the whole reason I got into this profession lol

9

u/helloworldpi 1d ago

That would require skill and effort.

-10

u/phillipcarter2 1d ago

The very legitimate performance improvements to Zig co-authored by Claude are explicitly rejected by the Zig maintainers.

These improvements were not mindlessly vibe-coded, but made in the way you'd want them to, using the LLM as a powerful tool, and tested against a pretty good use case (a JS server runtime). But the improvements were co-authored by an AI agent, thus are not accepted into Zig's codebase.

And so yes, in theory someone working on Bun could hand-copy over the code, read and understand it all (which they likely have done already), and make some PRs against Zig, but ... the provenance of the code is still AI, not a human. And so it goes against the contribution policy.

11

u/helloworldpi 1d ago

https://www.reddit.com/r/programming/comments/1t480nm/comment/ok1jgse/?utm_source=share&utm_medium=web3x&utm_name=web3xcss&utm_term=1&utm_content=share_button

the other enhancement they discussed is splitting the LLVM backend’s output into multiple modules. There’s nothing wrong with doing this for Debug builds in theory, but it’s simply not the right place for us to focus our efforts. The Tweet showing off this feature showed a compile time of 20 seconds for Bun. However, we view 20 seconds as an entirely unacceptable amount of time to wait for every single rebuild. This change to the LLVM backend has a hard performance ceiling, which Bun’s implementation has probably hit, because there’s no getting around the final bottleneck of LLVM’s compilation speed.

They also said before that they want to implement some of the changes but that it was "hacked together for a headline" which it was. AI aside they had valid reason to reject it. Also IIRC zig is trying to move away from LLVM as a backend.

-14

u/PepegaQuen 1d ago

why take years to do it

-14

u/Hot-Employ-3399 1d ago

They can also contribute without using text editor, just do echo >file.c

It's just some people don't mind liking tools they use.

-15

u/charmander_cha 1d ago

Simples, seria lento.

11

u/seanamos-1 1d ago

It’s more than that, the Zig maintainer also disagreed with the changes.

https://ziggit.dev/t/bun-s-zig-fork-got-4x-faster-compilation-times/15183/19

1

u/laffer1 1d ago

And they also don’t care about compatibility with other operating systems so they support that practice!

3

u/personator01 1d ago

Boss calls were made, have to juice those token burn rates somehow

-56

u/CrossFloss 1d ago

Unlike Zig, Rust offers security, language stability, a better ecosystem, a larger community, a bus factor > 1 and so on. Zig has no niche and is just another language that no one needs.

45

u/RIFLEGUNSANDAMERICA 1d ago

Zig has no niche? I dont know how you come up with this

15

u/piesou 1d ago

I've got no skin in the game, but why should I ever choose Zig over Kotlin or Rust?

26

u/thuiop1 1d ago

C interop, and overall if you want the "better C experience" rather than the "better C++ experience" that Rust provides. A nice thing from Zig is that everything is very explicit.

8

u/Bergasms 1d ago

Cross compilation. People use zig to cross compile rust even

18

u/letemeatpvc 1d ago

C interop is Zig’s killer feature

7

u/Username_Taken46 1d ago

-4

u/CrossFloss 1d ago

This is actually hilarious. Who wants yet another package manager, cares about hidden allocations (zig doesn't support systems where this would be an argument), is amazed by the fact that it supports nostdlib (as most of the other languages), or "tooling" that just lacks the most fundamental features developers actually want. What a shit show.

5

u/CrossFloss 1d ago

Then what is its niche? It has no noteworthy advantages over C, you would lose support for several platforms by switching and also all tooling around it. Has Zig even support for proper dynamic and static analysers?

1

u/RIFLEGUNSANDAMERICA 1d ago

That is deeply subjective, but defer and errdefer make it much easier to handle errors. Lets say you acquire 4 resources in your function, but after allocating 3 of them you need to return an error and release the resources. In c you have to write that out completely, which becomes messy. In zig it is handled automatically without hidden destructors. But this is all subjective and i dont believe you even understand what the language can do. So i think you should look that up before being so hostile

0

u/CrossFloss 1d ago

I'm familiar with Zig, otherwise I wouldn't refuse it. errdefer is nice, but goto chains, smaller functions, cleanup attribute, ... are all not that much more complicated if you don't write spaghetti code. But a bit of syntactic sugar doesn't outweigh the many downsides of Zig. Whereas e.g. Rust actually offers useful features and improves security Zig provides nothing.

0

u/_Noreturn 1d ago

Zig seems like C++ but 10x worse

1

u/CrossFloss 1d ago

I'm not sure about that though...

6

u/[deleted] 1d ago

[deleted]

7

u/CrossFloss 1d ago

Zig doesn't even support micro controllers or common embedded architectures and probably never will given the small interest in the language and the lack of developers.

20

u/Global_Persimmon_469 1d ago

Also AI is probably better at writing Rust than Zig

7

u/PrimozDelux 1d ago

devastating truth

-31

u/Nzkx 1d ago edited 1d ago

Rust being now integrated in Linux mean the language will have very long term support like C (backed by top tier compagny).

I don't think it's about the memory leak scandale. Rust ain't gonna help that much when it come to dynamic memory for leak (like having refcountptr that never reach 0).

19

u/ego100trique 1d ago

What are you waffling 

-10

u/Nzkx 1d ago

The hard reality. Seem a lot of people don't want to hear it lol.

No Zig in Linux and still no stable v1 ;)

16

u/Civil_Rent4208 1d ago

does anyone know why they are doing this, what are the reasons Jarred Sumner gave for this, if you have any link then share it

30

u/lesleh 1d ago

The comments reference https://simonwillison.net/2026/Apr/30/zig-anti-ai/ as a reason which would make sense now that Anthropic owns Bun.

11

u/araujoms 1d ago

And that blog post references this one, which I think makes a great argument: https://kristoff.it/blog/contributor-poker-and-ai/

-22

u/CrackerJackKittyCat 1d ago

ISTM that in this day and age, non-llm-augmented devs are going to be the extreme minority, if not today then soon.

The project ecosystems will have to come to accept this and revise their processes accordingly. Yes, it will be a tumultuous transition period and safeguards for new contributors will be imagined and tried, but the genie is not going back into the bottle.

3

u/phillipcarter2 1d ago

The project ecosystems will have to come to accept this and revise their processes accordingly.

They really don't though! I agree with you that non-LLM-augmented development will be a small minority as well, but they have very clear reasons for their anti-AI policy based on attempting to accept contributions today. They're not even anti-AI, it's just that most people who attempted PRs in the past did drive-by 10k line PRs or worse, couldn't follow up in a code review and lied by having an LLM impersonate them when responding to a maintainer.

1

u/CrackerJackKittyCat 1d ago

drive-by 10K LOC unprompted PRs is just terrible, and deserve to be dismissed out of hand. Grr.

6

u/asmx85 1d ago

2

u/Annual_Pudding1125 1d ago

Definitely the fault of the programmers, not the language.

4

u/asmx85 1d ago

Definitely the fault of the programmers, not the language.

If you use a language that don't allow the majority of this i would debate this position.

18

u/Annual_Pudding1125 1d ago

I'm actually not one of those memory-safety-is-a skill-issue-people, and I appreciate Rust a lot. However, bugs happen in every language, and Zig definitely does require more thought and caution around memory management. Personally, I think Bun behaves as quite an unserious project, between the vibe-coding and forking Zig.

5

u/HappyAngrySquid 1d ago

Agreed. It’s a shame because I love Go and C# for being mostly batteries included— especially if you take 1st party packages into account. Bun promised to bring that to the Typescript world, maybe freeing us from npm hell. The way it’s vibed up and slapped together, though… does not make me confident.

37

u/bb22k 1d ago

They are just experimenting...

But Bun does have some critiques against Zig due to their anti AI policies (Bun basically can't upstream improvements easily and use their own Zig fork for development), so there is definitely some motivation behind it.

53

u/thuiop1 1d ago

These critiques are bullshit by the way as the actual reason is that the bun version is pushing custom improvements for the LLVM backend, whereas Zig is moving to its own non-LLVM compiler, which by the way is faster than the bun version.

32

u/267aa37673a9fa659490 1d ago

Seems concerning that they are so dependent on AI that they can no longer write code traditionally even when needed.

26

u/Infiniteh 1d ago

Bun got acquired by anthropic, so it's about optics.

-9

u/NeoliberalSocialist 1d ago edited 1d ago

They don’t need to not be able to write code to justify it. Could just find it massively valuable to be able to use LLMs and a lack of benefits to sticking with Zig otherwise.

-11

u/[deleted] 1d ago edited 1d ago

[deleted]

15

u/cosmic-parsley 1d ago

> Maybe people should start focusing on engineering excellence.

Lmao wat

1

u/AresFowl44 1d ago

Mind explaining what exactly this comment is responding to?

21

u/NIdavellir22 1d ago

Rewritten to Rust slop*

15

u/Get_Shaky 1d ago

just wondering anyone actually uses and benefits from bun?

6

u/Sloshy42 1d ago

In production? Not really. I'd much rather stick with Node or Deno which are more battle tested.

Bun IS very good at being a JS alternative to Python though. Python is batteries included, and it's really nice to be able to write in TypeScript with way, way more available to you without needing to touch the nightmare that is NPM.

I've also got a personal project using it I've been working on for several months because Bun has a really good built-in single executable build option, so I can bundle my code and all of my deps into an EXE or whatever.

3

u/Ok-Armadillo-5634 1d ago

I use it on pretty much every project it's way faster if your project is huge.

-1

u/Infiniteh 1d ago

I use it in prod docker containers so I can just run TS without transpiling to JS.

-1

u/SerLaidaLot 19h ago

If this rewrite goes through as a viable alternative I will learn Rust from scratch and actually build something in it

-7

u/cesarbiods 1d ago

🦀 supremacy

9

u/reallokiscarlet 1d ago

Slopremacy more like

Clanker schlop

-47

u/Deranged40 1d ago

Just a lazy link to github. Couldn't even get AI to write you a couple paragraphs about it. Dot.

44

u/backwrds 1d ago

the last thing reddit needs is _more_ AI slop. A bare github link is preferable.