> I’ve cut over 11,000 lines of completely dead code from Bun. I can’t think of another project whose codebase was so neglected as to reach 11K lines of dead code. I’ve also rewritten and modernized parts of the codebase, trying to rely more on Zig’s stdlib. In the process, countless bugs have also been fixed. This is astonishing. Is anyone else surprised at this dead code figure? Is it a feature of large projects I'…
Buz – A fork of Bun using modern Zig, with sub-1s incremental builds
61–70 of 202 posts
Re: Buz – A fork of Bun using modern Zig, with sub-1s incremental builds
#62> I’ve cut over 11,000 lines of completely dead code from Bun. I can’t think of another project whose codebase was so neglected as to reach 11K lines of dead code. I’ve also rewritten and modernized parts of the codebase, trying to rely more on Zig’s stdlib. In the process, countless bugs have also been fixed. This is astonishing. Is anyone else surprised at this dead code figure? Is it a feature of large projects I'…
The 1.8% feels high if it's trivially dead. When I've run simple static analysis on decent codebases before, it's been much lower. For non-trivial dead code, it might be low. E.g. a lot of projects have piles of "dead" code behind ancient feature flags that would never be switched.
A small amount of dead code is fine. E.g. it might not be worth deleting utility methods that you happen to remove the last use of if they are simple and you might re-add a use later. Generated code is often dead since it's not worth specifying to the generator exactly what will be used. Other times, deleting dead code can lead to a valuable cascade of other deletions and simplifications.
Re: Buz – A fork of Bun using modern Zig, with sub-1s incremental builds
#63Re: Buz – A fork of Bun using modern Zig, with sub-1s incremental builds
#64Re: Buz – A fork of Bun using modern Zig, with sub-1s incremental builds
#65Earlier quoted context omitted.
The Zig compiler compiles lazily and does not detect dead code. (Read: functions that are not called from any compiled functions)
That makes total sense (though it would be nice if it could do that detected, I suppose), but what makes less sense to me is the accumulation of unnecessary code (and presumably unit tests for that code) that isn't removed as soon as it's no longer needed.
Re: Buz – A fork of Bun using modern Zig, with sub-1s incremental builds
#66Re: Buz – A fork of Bun using modern Zig, with sub-1s incremental builds
#67Earlier quoted context omitted.
LLMs are as good as the operator directing them.
The error bars on that one are too large to fit on screen, but yes.
You can make them output what you would've written yourself, but that would be slower than writing it yourself, so no one does that - but it’s trivially true.
Re: Buz – A fork of Bun using modern Zig, with sub-1s incremental builds
#68This is what I like to call performative performance programming. I _LOVE_ performance as much as the next guy. And build times should be as close to 0 seconds as possible. But this is approaching diminishing returns and I guarantee that your CURRENT bottleneck is not build times.
The people who originally worked on Bun themselves would disagree with your point (but their situation was based on the premise that they did not take the steps required to leverage incremental compilation): https://zackoverflow.dev/writing/i-spent-181-minutes-waiting... And, unrelated to Bun, I too would disagree. You don't want to have to wait minutes for a build to complete before you can run the test suite, or ev…
90 seconds to less than 1 second. That's astonishing
Re: Buz – A fork of Bun using modern Zig, with sub-1s incremental builds
#69Earlier quoted context omitted.
That makes total sense (though it would be nice if it could do that detected, I suppose), but what makes less sense to me is the accumulation of unnecessary code (and presumably unit tests for that code) that isn't removed as soon as it's no longer needed.
hard to detect. what if a whole code branch is used by macos and you're on x86?
Re: Buz – A fork of Bun using modern Zig, with sub-1s incremental builds
#70> To this end, LLMs will be used extensively to deslop... So we're using LLMs to clean up the code that LLMs ruined in the first place? We’ve reached peak tech in 2026.
I’d say I fall in the “AI skeptic but willing to use it” category. If LLMs can actually clean up after themselves it would actually be a game changer.
The main problem is that pointing an LLM at a codebase and telling it to just "make it better" taps out pretty quickly. That is, not that there's zero juice to squeeze there, but there's not a ton. You can get a bit of improvement but it also rapidly starts changing things just to change things, which I'm not even going to complain about all that much because there's a sense in which it is simply doing as you asked.
So you still need human taste and direction. This will be especially true for something the size of that codebase where you can only hold small fractions of the actual code in the context window at once. Summaries only get you so far.