Fireship · @fireship

The most controversial rewrite in history just shipped...

Uploaded July 15, 2026 · Length 5:52

The most controversial rewrite in history just shipped...

Summary

Bun rewrote its entire codebase from Zig to Rust using AI, fixing bugs and improving performance, sparking controversy with Zig's creator.

  • bun zig rust rewrite
  • ai code generation
  • memory management bugs
  • programming language controversy
  • anthropic claude ai

Transcript preview

The first 2 minutes of the transcript. Select a timestamp to watch that moment on YouTube.

  1. 0:00

    Last week, Bun, the all-in-one

  2. 0:02

    JavaScript toolkit that was acquired by

  3. 0:04

    Anthropic late last year, announced that

  4. 0:06

    they spent the equivalent of $165,000

  5. 0:09

    running 64 parallel clot agents to

  6. 0:12

    refactor their entire codebase from Zigg

  7. 0:14

    to Rust in just 11 days. Usually, a full

  8. 0:17

    rewrite to Rust is the swan song of any

  9. 0:20

    startup about to get Rick James by the

  10. 0:21

    invisible hand of the market, but in

  11. 0:23

    this case, it may have actually worked.

  12. 0:25

    The millionline port fixed 128 old bugs,

  13. 0:28

    shrunk the binary by 20%, made

  14. 0:30

    everything a few% faster, and has

  15. 0:32

    already been powering Claude code since

  16. 0:34

    June without anyone noticing. But not

  17. 0:36

    everyone is celebrating. Andrew Kelly,

  18. 0:38

    the creator of Zigg, responded claiming

  19. 0:41

    the benchmarks are misleading, and the

  20. 0:42

    Zig team is actually relieved to see Bun

  21. 0:45

    go because internally they used its

  22. 0:46

    codebase as an example of how not to

  23. 0:48

    write Zigg and that Jared, Bun's

  24. 0:50

    founder, was producing SLOP long before

  25. 0:53

    LLM existed. In today's video, we'll

  26. 0:55

    find out how the biggest AI powered

  27. 0:57

    rewrite in history actually went down

  28. 0:59

    and decide who should get custody of

  29. 1:00

    public opinion in the divorce. It is

  30. 1:02

    July 15th, 2026, and you're watching the

  31. 1:05

    code report. That 26 years ago, when I

  32. 1:07

    was throwing Japan airs in the

  33. 1:08

    warehouse, Joel Spolski wrote one of the

  34. 1:10

    most famous blog posts in software

  35. 1:12

    history where he claimed that rewriting

  36. 1:14

    your codebase is the single worst

  37. 1:15

    strategic mistake a software company can

  38. 1:17

    make. His example was Netscape, who

  39. 1:19

    spent three years rewriting their

  40. 1:21

    browser while Microsoft stole their

  41. 1:22

    women and pillaged their village. So,

  42. 1:24

    what led Bun to fall to the temptation

  43. 1:26

    of the single word strategic mistake

  44. 1:28

    they could make? Well, it's actually the

  45. 1:30

    same thing that led you to fail CS 101,

  46. 1:32

    switch majors, and become a JavaScript

  47. 1:34

    developer, but poor memory management.

  48. 1:36

    With Zigg, the language Bun was

  49. 1:38

    originally written in, you manually

  50. 1:40

    manage memory yourself without much help

  51. 1:42

    from the compiler. That's usually a

  52. 1:43

    feature of a low-level language because

  53. 1:45

    Bun embeds JavaScript core, which is

  54. 1:47

    Safari's garbage collected JavaScript

  55. 1:49

    engine. Half of Bun's objects were owned

  56. 1:51

    by the garbage collector, while the

  57. 1:53

    other half lived in manually managed Zig

  58. 1:55

    memory, and the two had to constantly

  59. 1:57

    manage pointers to each other, which led

  60. 1:59

    to a codebase that looked like it had an