Please don't bloat your software

Unless you’ve been living under a rock, or aren’t into programming1, you have probably noticed that programs are getting increasingly more bloated, every day, at an unprecedented rate. For example, uu_ls (an implementation of ls(1) in Rust, part of uutils) is about 1 MiB stripped2. I tried to ask on Rust’s subreddit, and while I got some answers, none of them were satisfactory.

Out of all the replies, this one stood out to me (quoting only the relevant part):

It is very hard to think of circumstances where it matters whether ls is 10KB or 10MB, though I agree it does seem to conflict with a some developers' ideas of what systems programming ‘is’.

I just want to note here, before I reply, that I do not have any personal issues with this person. I do not believe that I have a following (although I don’t use any analytics, so I don’t know for sure), however if I do, I ask you kindly to not bother any of the people who are mentioned here. It’s a non-participatory link for a reason.

With that out of the way, my response, predictibly, is that I think their opinion is straight-up wrong. I’m not saying that out of elitism, or because I think that it’s not “systems programming”3, but because it’s harmful. For such small programs, at the very least.

The thing is, my internet connection isn’t very good. It’s kind of slow, most websites take at least a few seconds to load, etc. Sometimes it gets better, randomly, but it isn’t very stable. And I’m European, living in a relatively wealthy country in a middle-class family. It gets much worse in poorer regions.

So, what does that have to do with binary sizes? In case it isn’t obvious, downloading bigger binaries takes more time. The extra 0.8 MiB that Rust adds aren’t very significant for larger programs (that take a lot of time to download anyway), however, it’s really obvious with such simple programs as ls. Adding that little overhead to all of the coreutils programs would make my system updates a few times slower (well, at least the part where coreutils is being updated).

I got another similar comment:

Weirdly this question comes up a lot from C programmers even though for the vast majority of software it is irrelevant?

Yes, it is irrelevant for the vast majority of software individually. Adding them up, though, can add a few hundred mibibytes4. It was solved with dynamic linking decades ago, yet people want to reject it. Yes, dynamic linking is not the most elegant solution, that would be to make your overhead smaller, but it’s good enough.

As always, I’m willing to listen. Please, if you know something better than I do then contact me. But so far, nobody that I asked managed to provide a convincing answer.

And with that, this post is over. I wish you all a Happy (Gregorian) New Year!

(I know it was a bit ranty, but I’m quite annoyed by this nowadays. I hope it wasn’t unreadably, I didn’t proofread it at all. Also, I’m still not picking on Rust. It was just a good example. Thank you for your understanding.)

  1. In that case though, why would you be reading my blog? ↩︎

  2. Stripping means removing unnecessary debug information from an executable, in case you didn’t know. ↩︎

  3. “Systems programming” is hardly a thing anyway. Seriously, whose idea was it to group together OS development with anything related to embedded, OS tool development and compiler development? ↩︎

  4. Yes, that’s how you spell out MiB. Saying “Megabyte” would be incorrect, since a Megabyte is 1,000,000 bytes. ↩︎