WEBVTT

00:00:00.060 --> 00:00:13.700
Speaker 0: Bun was ported from Sig to Rust.

00:00:14.500 --> 00:00:21.760
Speaker 0: This is really interesting, also regarding how AI was leveraged and what that could mean for similar projects in our industry.

00:00:22.920 --> 00:00:26.560
Speaker 0: Now just as a little side note I personally like BUN quite a bit.

00:00:26.660 --> 00:00:28.880
Speaker 0: it's my default javascript runtime.

00:00:28.960 --> 00:00:35.600
Speaker 0: i use on most of the projects A brand new course on Bunn last week.

00:00:36.060 --> 00:00:39.000
Speaker 0: And it works, of course for the Rust version as does for the SIG version.

00:00:39.340 --> 00:00:47.940
Speaker 0: So if you want to dive a bit deeper into bun and learn about all the core APIs It has to offer because that's one of the biggest advantages Of bun that is so much stuff built in.

00:00:48.380 --> 00:00:49.280
Speaker 0: some people don't like it.

00:00:49.500 --> 00:00:50.020
Speaker 0: I love it.

00:00:50.440 --> 00:00:53.080
Speaker 0: If You Want To Learn More About That That Course May Be Interesting.

00:00:53.200 --> 00:00:57.420
Speaker 0: But Let'S Now Take A Closer Look At The Overall Porting Timeline Shall We?

00:00:58.340 --> 00:01:08.100
Speaker 0: It Actually Happened Two Months ago So the blog post was released last week in July, but the port itself happened in May.

00:01:08.840 --> 00:01:15.180
Speaker 0: And it started in early May when the Claude-Phaser port branch was discovered on the official BUN GitHub repository.

00:01:15.660 --> 00:01:25.160
Speaker 0: That branch contained a porting MD file, or markdown file with instructions of how to convert SIG code into Rust code and how to port that code.

00:01:26.020 --> 00:01:28.600
Speaker 0: Translation tables...and general instructions!

00:01:29.680 --> 00:01:43.280
Speaker 0: That was discovered, so naturally discussions ensued on Hacker News on X and there were people excited about that.

00:01:43.380 --> 00:01:47.740
Speaker 0: There were very critical of it but at the point we didn't know a lot.

00:01:47.980 --> 00:01:52.560
Speaker 0: obviously there is a lot of polarization around Rust.

00:01:54.600 --> 00:01:56.900
Speaker 0: Like myself, there are people that hate Rust.

00:01:57.180 --> 00:02:07.900
Speaker 0: There are people who hate everything should be rewritten in Rust because very often you read the People Want program XYZ to be written in Rust and I get this is annoying.

00:02:08.280 --> 00:02:13.980
Speaker 0: but naturally therefore there was a lot of polarization going on But The port had not yet happened.

00:02:15.080 --> 00:02:30.100
Speaker 0: That changed later In May And On may fourteenth an official poll request Was opened then also merged that actually migrated the buncode base, all of it from SIG to Rust.

00:02:30.180 --> 00:02:32.180
Speaker 0: Now as you can see It's a huge pull request.

00:02:32.340 --> 00:02:39.980
Speaker 0: more than one million lines of code were added and The removal of the SIG code happened in at different stage.

00:02:40.040 --> 00:02:46.580
Speaker 0: So yeah That why its not a swap But Its A Huge Change As You Can See With Almost Seven Thousand Commits.

00:02:46.700 --> 00:02:54.500
Speaker 0: Now Naturally... ...That Code Was Not Human Reviewed At Least Not Entirely by AI.

00:02:54.600 --> 00:02:59.040
Speaker 0: it had passing tests, but not human reviewed.

00:03:02.680 --> 00:03:05.860
Speaker 0: But that was published or merged.

00:03:06.360 --> 00:03:08.080
Speaker 0: And of course more discussion ensued.

00:03:08.140 --> 00:03:10.840
Speaker 0: now, as I just mentioned it was not reviewed by humans.

00:03:10.880 --> 00:03:30.540
Speaker 0: that's impossible to do in that timeframe but the community dove-in and had a look at analyzed parts…and then there were another blog post about the use.

00:03:32.720 --> 00:03:41.280
Speaker 0: Because one big criticism that came up after this poll request is, That the rust code in there was not idiomatic Rust.

00:03:41.380 --> 00:03:46.260
Speaker 0: It wasn't kind of a rust code you would or should write if were building it from scratch.

00:03:46.380 --> 00:03:49.940
Speaker 0: Instead really like a translation From SIG to RUST.

00:03:50.600 --> 00:04:00.100
Speaker 0: And that meant Not all those Rust best practices and patterns Were used and especially There was decent amount unsafe usage in there.

00:04:00.300 --> 00:04:25.980
Speaker 0: Now to understand Unsafe you have to understand how Rust manages memory because that is one of its biggest advantages and it's quite different from other languages, Because In most languages You Have either a garbage collector Which Is A Process That Basically Detects When A Value Is No longer Used Anywhere In The Program And Then Freezes Up the Memory which Is Convenient But Consumes Extra Resources or you have to do it yourself.

00:04:26.080 --> 00:04:42.840
Speaker 0: In languages like C for example, You have to manually allocate and free up memory And its the same in SIG!

00:04:53.400 --> 00:04:55.140
Speaker 0: This scope ends essentially.

00:04:55.540 --> 00:05:03.980
Speaker 0: And that's nice because there are different situations where a value may no longer be needed, but still when you have to clean up memory manually.

00:05:04.460 --> 00:05:07.280
Speaker 0: There are many situations where you can shoot yourself in the foot.

00:05:07.380 --> 00:05:11.200
Speaker 0: You have more fine-grained control and it can be very useful Very efficient.

00:05:11.360 --> 00:05:24.820
Speaker 0: But It is also easy To forget situations In more complex programs Where you then May not Be cleaning Up Memory Hence introducing A memory leak or cleaning up twice, which will also cause an error.

00:05:25.420 --> 00:05:38.200
Speaker 0: And therefore there is a trade-off and Rust has And it's tied to scope.

00:05:38.260 --> 00:05:43.900
Speaker 0: So if you have a scope, and you can create scope by using curly braces or function would also have its own scope.

00:05:43.980 --> 00:05:45.960
Speaker 0: You may know that concept from JavaScript.

00:05:46.380 --> 00:05:58.460
Speaker 0: If you have scope then when a value is created in there It's owned by that scope but after the scope ends And that of course is very convenient because you don't have to take care about freeing it up.

00:05:58.580 --> 00:06:02.180
Speaker 0: You also do not have a garbage collector, instead you have the clear rule!

00:06:02.360 --> 00:06:19.000
Speaker 0: That can lead to complexity in more complex programs where you need to pass values around…you can do this in Rust but it requires different ways of thinking...but ofcourse gives you memory safety unless you use the unsafe keyword.

00:06:19.660 --> 00:06:28.440
Speaker 0: If you use that and create an unsafe scope And in there, those rules no longer apply and it's then your job to make sure that memory is managed appropriately.

00:06:28.880 --> 00:06:29.800
Speaker 0: Now why would you do that?

00:06:29.940 --> 00:06:40.260
Speaker 0: Well for example if you're pulling in some C library which you can do in Rust... You can blend in some c code so-to say or call some C Library of methods & functions.

00:06:40.980 --> 00:06:48.500
Speaker 0: Then since C is naturally unsafe the code where you reach out to that C Code Is also unsafe.

00:06:48.540 --> 00:06:52.100
Speaker 0: So you need that feature To interact with our UnsafeCode.

00:06:52.960 --> 00:07:08.720
Speaker 0: And that is also one thing they noted in their official statement, That all those unsafe usages In the codebase to a decent part were actually related To calls to other libraries C libraries and so on which won't change.

00:07:08.800 --> 00:07:11.000
Speaker 0: but They also identified areas where?

00:07:18.880 --> 00:07:20.540
Speaker 0: They did and still are doing that.

00:07:20.640 --> 00:07:26.140
Speaker 0: So you can think of this initial port as like a starting point, which then got refined over time.

00:07:26.440 --> 00:07:32.140
Speaker 0: Still worth mentioning That this initial pull request or that huge poll requests already had passing tests.

00:07:32.360 --> 00:07:33.780
Speaker 0: so it was stable.

00:07:34.160 --> 00:07:37.520
Speaker 0: the Tests were passing but The code wasn't out-of-the-code quality.

00:07:37.620 --> 00:07:42.380
Speaker 0: You would maybe expect if it were written in rust from the grown up because that wasn't the goal.

00:07:43.020 --> 00:07:44.920
Speaker 0: So that was May twenty first.

00:07:45.080 --> 00:08:11.100
Speaker 0: Then there was silence and it's also worth noting, this version of BUN wasn't released yet but then on July the official blog post was released where we find lots of interesting details about this port because there is a lot to learn here.

00:08:11.360 --> 00:08:15.120
Speaker 0: This entire port, and that's no secret was done with help of AI!

00:08:15.380 --> 00:08:26.020
Speaker 0: It's worth keeping in mind that BUNN is owned by Anthropics so they had free access all those tokens AND especially also to Fable V before it was released for the public.

00:08:29.800 --> 00:08:35.679
Speaker 0: And if you're installing Claude code now btw even though BUNn one point four the Rust version isn't yet.

00:08:36.200 --> 00:08:43.480
Speaker 0: Claude code is already running on top of an unreleased banner version, so to say that it's the Rust version.

00:08:44.200 --> 00:08:45.160
Speaker 0: So there's that.

00:08:45.580 --> 00:08:54.500
Speaker 0: but yeah this port was done with Claude Code based fable five with free tokens, of course essentially since bun is part of anthropic.

00:08:55.000 --> 00:09:13.780
Speaker 0: And that's important to keep in mind because In that blog post we learn That if you were To Combine all the Tokens or If You were to sum up All The Tokens That Were Spent and Charge API Prices This Entire Port Would Have Cost Around One Hundred and Sixty Thousand Dollars.

00:09:13.920 --> 00:09:15.800
Speaker 0: That'S a Mind Blowing Number.

00:09:16.120 --> 00:09:25.680
Speaker 0: but Actually If you think about the scope of this project, and the scope is that bun was five hundred thirty-five thousand lines off sick code.

00:09:26.920 --> 00:09:31.860
Speaker 0: if You Think About That Scope And How Long It Would Take Humans To Port That Trust.

00:09:32.500 --> 00:09:38.860
Speaker 0: Then The One Hundred Sixty Thousand Dollars Actually Might Not Sound Too Bad Depending On Where Your Located Now.

00:09:39.400 --> 00:09:49.960
Speaker 0: Nonetheless It's clear that no open source project would be able to do this and most companies probably wouldn't spend the amount of money on a port.

00:09:50.600 --> 00:10:02.600
Speaker 0: This is possible because BAN is part of Anthropic, but also a nice marketing stunt for Anthropic which may not have been the main intent.

00:10:03.380 --> 00:10:06.060
Speaker 0: I don't know that, but of course it's nice marketing.

00:10:06.140 --> 00:10:08.200
Speaker 0: That is all important to keep in mind.

00:10:08.440 --> 00:10:15.280
Speaker 0: nonetheless In this blog post we can learn how Jared Did dat port or he?

00:10:16.400 --> 00:10:37.340
Speaker 0: Yeah made Datport work and that all started with that porting MD file which He created a discussion with Claude in the three-hour discussion as you mentioned in the blog post where he essentially decided together Claude code and the anthropic models, how such a porting MD file would have to look like?

00:10:37.380 --> 00:10:40.280
Speaker 0: To be able to translate SIG to Rust code.

00:10:40.980 --> 00:10:52.840
Speaker 0: Then once he iterated on that and was happy with it, He tested it on three files initially And when she was happy With that he unleashed Claude On The entire bun code base.

00:10:53.220 --> 00:10:59.000
Speaker 0: Now in this blog post he makes it clear that he did not just prompt Claude to rewite, bun and rust.

00:11:00.200 --> 00:11:17.820
Speaker 0: But instead set up an elaborate system where main agent, spinning up sub-agents too of course doing the port according to the porting MD file and then he had two adversarial review agents that reviewed The work off.

00:11:17.880 --> 00:11:23.920
Speaker 0: That main Asian once it was done And provided feedback and then a fixer agent for applying that feedback.

00:11:24.220 --> 00:11:34.740
Speaker 0: and yet they're all running in a loop and of course distributed across multiple Work trees to process the entire code base and work its way through it.

00:11:35.060 --> 00:11:44.560
Speaker 0: In the blog post he mentioned that he rewrote bun and rust using fifty dynamic workflows in clod code, which are these workflows that spin up a lot of sub-agents over the course.

00:11:46.760 --> 00:12:08.120
Speaker 0: So that all happened with help of loops in Claude code, which helped a lot of sub agents and the clear process off one main agent.

00:12:08.560 --> 00:12:10.660
Speaker 0: The review agents at the fixer agent.

00:12:11.260 --> 00:12:19.600
Speaker 0: And then he also did another separate pass, so to say making all those tests work.

00:12:20.380 --> 00:12:31.400
Speaker 0: And that brought its own challenges because the test suite is so large and complex that he ran into various infrastructure restrictions because some tests consume a lot of memory.

00:12:31.700 --> 00:12:43.680
Speaker 0: running many tests in parallel therefore doesn't work but ultimately made it all work also with help from AI rerunning the tests and so on.

00:12:43.740 --> 00:12:52.580
Speaker 0: So lots of looping, lots of agents and sub-agents involved naturally in lots of tokens burned, one hundred and sixty five thousand dollars in tokens burnt!

00:12:53.180 --> 00:12:59.400
Speaker 0: Now again you can dive in deeper... And that is what I would recommend doing if you're interested in all the nitty gritty details.

00:12:59.460 --> 00:13:04.220
Speaker 0: it's a really great blog post documenting the journey to getting there.

00:13:04.640 --> 00:13:05.800
Speaker 0: but that isn't a nutshell.

00:13:05.980 --> 00:13:15.360
Speaker 0: how The Port happened over eleven days with all those agents distributed across multiple workflows, fifty such work flows as we learned.

00:13:15.840 --> 00:13:23.620
Speaker 0: Across or over eleven days one hundred sixty five thousand dollars spent in tokens at API prices.

00:13:24.760 --> 00:13:33.180
Speaker 0: Now finally once he was done In the blog post He mentioned that bun one point four fixes various bugs.

00:13:33.280 --> 00:13:47.940
Speaker 0: That last sick version has that it's more memory efficient than its smaller And as we learn by the response of Andrew Kelly, The Creator Of SICK some of these improvements could have probably all achieved with SICK.

00:13:48.200 --> 00:13:53.760
Speaker 0: But that blog post is pretty interesting because it got edited!

00:13:53.800 --> 00:14:05.520
Speaker 0: It's less full-of anger now than it was initially... ...the first version was FULL OF PERSONAL ATTACKS just to then say THAT IT WAS NOT MEANT AS A PERSONALE ATTack but it Was Full Of Personal Attacks.

00:14:06.260 --> 00:14:10.300
Speaker 0: The latest version, which I'll also link below is still pretty spicy.

00:14:11.220 --> 00:14:33.480
Speaker 0: In the end you can clearly tell from reading this first but also this one that Andrew, the creator of SIG and Jared, they won't become best friends anymore or again now he thanks bun for supporting SIG financially just basically.

00:14:34.280 --> 00:14:44.380
Speaker 0: yeah rage about this entire port and how it wouldn't have been necessary if the BUN code would've written in proper SIG.

00:14:44.520 --> 00:14:53.220
Speaker 0: He makes it very clear that he doesn't feel like the BUND repository, the SIG version had a high-code quality... And THAT led to many problems!

00:14:54.400 --> 00:14:56.300
Speaker 0: That may or may not be true.

00:14:56.820 --> 00:15:11.300
Speaker 0: I think its absolutely possible that IN A PROJECT OF THE SCALE OF BUN moving at speed in which bun use moves, code quality may not have been up to the standards of The Creator Of SIG.

00:15:12.280 --> 00:15:21.380
Speaker 0: You could definitely argue that most code projects don't necessarily have the highest code quality though so you can make off that whatever you want.

00:15:21.960 --> 00:15:24.400
Speaker 0: now I'll leave it at that.

00:15:25.100 --> 00:15:39.720
Speaker 0: i feel like the overall response blog post is pretty weak because Steaming with anger it has some valid points like for example in the blog post Jared makes.

00:15:40.140 --> 00:15:51.060
Speaker 0: he mentions that The port from SIG to Rust was validated of course with all these reviewer agents but also by running the test suite and making that work.

00:15:51.580 --> 00:16:15.200
Speaker 0: And Andrew correctly states, Definitely, these two won't become best friends and I have no opinion on whether SIG or Rust is the better language in general.

00:16:15.700 --> 00:16:16.580
Speaker 0: Or for BUN.

00:16:34.320 --> 00:16:41.140
Speaker 0: This entire port is really impressive when it comes to the use of AI.

00:16:41.240 --> 00:16:47.520
Speaker 0: And sure, It's a way of using AI that most of us won't be able to afford or want me willing to afford in companies.

00:16:48.180 --> 00:16:56.140
Speaker 0: but its impressive That I was able do that and Its not vibe coding Or just YOLO prompting.

00:16:56.580 --> 00:16:59.360
Speaker 0: There IS A clear process behind all of this.

00:16:59.720 --> 00:17:10.960
Speaker 0: A lot Of thought went into this Which i hopefully made clear which Definitely also gets clearer if you dive into the nitty gritty technical details, but with all planning and iteration of this setup.

00:17:13.800 --> 00:17:27.680
Speaker 0: Clearly not just one prompt thrown at it... This shows what you can do with AI and of course porting a code base from one language to another is pretty good use case for AI.

00:17:27.880 --> 00:17:35.680
Speaker 0: If you think about it, AI can struggle with writing new code that may not write the code.

00:17:40.980 --> 00:17:43.300
Speaker 0: Definitely, AI is amazing for building new software too.

00:17:43.380 --> 00:17:55.200
Speaker 0: But you face a different set of problems there with a port the huge advantages that You have a codebase For dai to just look at and translate which Is something ai can do?

00:17:55.680 --> 00:17:59.140
Speaker 0: And you Have a test suite There so there's A lot To build up on it.

00:17:59.180 --> 00:18:02.260
Speaker 0: It's a good use case for Ai as it seems an ass.

00:18:02.540 --> 00:18:11.100
Speaker 0: this Port clearly Proves and I think That is The most interesting takeaway here Also that you can tackle projects.

00:18:11.180 --> 00:18:14.000
Speaker 0: That just would have been impossible to tackle before.

00:18:14.080 --> 00:18:19.700
Speaker 0: again, not for everybody but For certain companies of certain sizes this may be interesting.

00:18:19.940 --> 00:18:30.020
Speaker 0: modernizing legacy software with help of AI Can or maybe a great use case and This shows and proves can be done.

00:18:30.560 --> 00:18:32.540
Speaker 0: Of course, BUN is not out yet!

00:18:32.620 --> 00:18:33.140
Speaker 0: We'll see.

00:18:33.240 --> 00:18:40.860
Speaker 0: if everything crashes and they have to revert in a month from now... You can't totally rule it but I personally don't think that will happen.

00:18:40.940 --> 00:18:47.080
Speaker 0: It's being used by some early adopters already like the Claude Code CLI.

00:18:54.920 --> 00:18:59.720
Speaker 0: But I'm pretty confident that this will work out and i find it a pretty impressive feat.

00:19:00.320 --> 00:19:03.300
Speaker 0: And also, A Pretty Impressive Usage of AI.

00:19:03.440 --> 00:19:07.960
Speaker 0: but as always...I am also interested in hearing what your thoughts are about all.