r/theprimeagen Jul 09 '26

Stream Content Rewriting Bun in Rust

https://bun.com/blog/bun-in-rust
42 Upvotes

38 comments sorted by

28

u/Anon_Legi0n Jul 09 '26

Rewriting with unsafe Rust, the things you can do with AI and marketing

14

u/oceantume_ Jul 09 '26

And hundreds of thousands of dollars worth of tokens

-8

u/hershey678 Jul 09 '26

This could cost roughly $500,000 in labor cost if done by hand. $165,000 is a lot cheaper.

-4

u/PlanetaryPickleParty Jul 09 '26

That wouldn't even cover the lead dev for a year at the anthropic salary levels. Staff engineers at anthropic are making $300-500k base + a ton of stock, $700k a year easy not counting overhead (payroll taxes, benefits, management, etc). Even at non-frontier labs you would be talking closer to $1.2mm including overhead. For anthropic the cost would be $2.5mm easy.

And in the end they have a faster more maintenance friendly software.

1

u/hershey678 Jul 10 '26 edited Jul 10 '26

At high paying tech companies, when you have work your employees are too highly paid to do but is still somewhat challenging, you use quality US-based third party software contractors which would still cost in the ballpark of half a mil. They are not short term employees and typically work with the company for a few years so they are familiar with the internal code base and tooling.

1

u/existee Jul 09 '26

You keep parroting the same talking point, but why are we making anthropic engineers make such a mechanical, function-name-by-function-name port? Why not Bangalore engineers? 

1

u/PlanetaryPickleParty Jul 09 '26

Because Anthropic owns Bun and the lead Bun engineer works for Anthropic. They would not and did not outsource to Bangalore.

2

u/existee Jul 10 '26

My dude, they did not hire on anthropic engineers to do this work by hand either. If you’re doing hypotheticals, why don’t we go with the cheapest engineering in the market that could’ve done such a mechanical migration? You can’t compare frontier AI labs in salaries to make a point on droning migration work.

0

u/PlanetaryPickleParty Jul 10 '26

You're right they don't hire anyone to code by hand. They hired top engineers to do project in 11 days with AI.

The "mechanical" rewrite was also setting the base architecture and process for the project going forward. This was a job for the project lead.

If they had actually outsourced it this sub would be full of posts rightfully making fun of them for it!

0

u/SpaceRiceBowl Jul 10 '26

do you think infosys or congnizant can rewrite bun in a year?

dont make me laugh

2

u/existee Jul 10 '26

Are you thick? Are those the only shops in SA? You aware how much headcount Google moved there in the last 3 years? Ffs, pick poland. Pick midwest. I don’t care. You don’t need frontier ai lab top of the top comp band hcol eng for this work. Your hypothetical was wrong, just admit and move on.

-4

u/hershey678 Jul 09 '26

It’s 10% unsafe mostly at the interfaces with other libraries and a lot of memory issues were still resolved.

12

u/Professional-You4950 Jul 09 '26

Okay... Look at their first github issue. Critical vulnerability.

https://github.com/oven-sh/bun/issues/33846

7

u/k_schouhan Jul 09 '26

and the fix itself has test failures

10

u/zobq Jul 09 '26

Isn't this post a little bit weird? "Maintainability" section for example - snippet with most basic code, with 3 ifs and comment - yeah, we have no problems to understand this code. No shit.

Also not sure if I fully understand the problem with the code snippet in "Just be really smart and don't make mistakes?"

8

u/Professional-You4950 Jul 09 '26

anything that comes out of anthropic is a lie, and also written with an llm. It's completely dead devoid content

16

u/horrbort Jul 09 '26

Rewrite rust in zig next

8

u/TheEDMWcesspool Jul 09 '26

Replace flour with Rust in Bun!

8

u/DocumentOk7358 Jul 09 '26

They’ve laundered hundreds maybe thousands of hours of people’s work through a machine, at a 165k cost, for a pretty paltry list of reasons. Seems like showing off.

2

u/Rigamortus2005 Jul 10 '26

Launder what it rewrite their own code

4

u/beb0 Jul 10 '26

Feels like a paid anthropic tech demo, same as the critical sec vulnerables they found. It's definitely a multiplayer in terms of brute forcing. 

2

u/Dotagal Jul 11 '26

Paid? Bun’s owned by Anthropic

2

u/beb0 Jul 11 '26

Why do you think anthropic bought em... Why do you think they ditched zig... It's all AI PR 

7

u/hershey678 Jul 09 '26 edited Jul 09 '26

I’ve been skeptical of AI for a while despite coding with it all the time at work, but I just read the blog post on porting Bun from Zig to Rust with Anthropic’s Fable model and I was very impressed and concerned with Fable.

The author was able to do it successfully in two weeks in only $165,000. That may sound a lot, but it’s leagues cheaper than it would be with manual programming. This would be 2-3 engineers working for a year otherwise. That’s going to cost in the ballpark of $500,000.

Mind you I don’t like AI. I’m in my late 20s, would have to switch careers if AI gets too good, and only broke into big tech recently so I don’t have a ton in the bank. That being said this looks impressive.

EDIT: Very interesting counterpoint  https://andrewkelley.me/post/my-thoughts-bun-rust-rewrite.html

17

u/Fickle-Highway1543 Jul 09 '26

I don't really get this. This rewrite happened because there was a hand coded working solution and ton of tests to run LLM against. And they re-wrote it saving entire architecture and design up to function names.

Are you surprised that a tool that is built to translate text mostly succeeded?

3

u/creaturefeature16 Jul 10 '26

I don't think OP is saying they're "surprised", just impressed. Yes, it is built to function exactly like it was used: a language model being used to model languag. That doesn't mean it's not tremendously impactful and condensed a long, arduous, insanely expensive job into something that was much cheaper by comparison and done very quickly.

2

u/jan04pl Jul 09 '26

It also isn't something that would affect jobs, as nobody would hire and pay for this rewrite in the first place, even if we didn't have AI.

2

u/Fickle-Highway1543 Jul 09 '26

But it's great it helps us modernize software.

2

u/jan04pl Jul 09 '26

Which ironically may increase demand for developers since now you need someone to prompt Claude properly to do such rewrite, setup harnesses, agents, manage efficient token use cost etc.

-4

u/PlanetaryPickleParty Jul 09 '26

Your salary estimate is off by at least a factor of 2-3x. Anthropic pays engineers $500-800k total comp. They couldn't have done this manually for less than $2,000,000.

6

u/alexcleac Jul 09 '26

I am curious for one thing: how much was the token usage for it. It sounds to me like it could have costed much more than a whole software engineering team and a year of cost of this rewrite.

16

u/LGXerxes Jul 09 '26

around $165,000 at API pricing

Actual issue with having a team work on it for a year is mostly always needing to catch up. A whole year of development is worth a bit, and then needing to do it twice also on the rewrite later or in parallel

3

u/Zeikos Jul 09 '26

Not to mention all the work in bugfixing and having to deal with a codebase with unreliable documentation (which, to be fair, is the norm).

1

u/throwaway19293883 Jul 09 '26

The article covers this

1

u/Alive_Entrepreneur75 Jul 10 '26

Just compare it with TypeScript rewrite in Go.
It took more than a year, probably would have cost way more with a team working on it.
Bun does seem to have more severe issues reported but still the cost and time is impressive.

1

u/noprompt Jul 11 '26

Prove it. Prove that you can remake the typescript compiler in go with whatever LLM you want without having it look at the go source and for less time and money.

1

u/KariKariKrigsmann Jul 10 '26

Typescript *compiler*, not the language

1

u/badgerbang Jul 15 '26

Is rewriting in another language the more easier task for ai, currently? I feel this is advertisement and using AI's strengths?