1 min read

Smaller code, Better code

I was enjoying some pizza the other day with some buddies that know a bit about my research and understand where I am coming from with regards to my own computing aesthetics. They understand that I have always pushed for the smallest code that I can get, and to simplify as much as possible.

A bit as a joke, they've pointed out how the evolution of my own compiler has evolved. I took a look at the code checkout today and what's available on GitHub to see just what the stastistics were.

Right now, I have around 750 LoC in this compiler. The compiler currently does more on more platforms and more hardware and more operating systems than ever before. It supports more primitives and has a more expansive runtime library than ever before. It's more robust, more reliable, and more capable in every sense than it ever has been before. It's also perhaps the smallest it has ever been before, as well.

They've joked that it's hard to see movement on my compiler because the public interface to the compiler is so intentionally simple that it rarely changes. Instead, there's a ton of "churning" under the hood. While this isn't exactly the most exciting work from the outside, it has a tremendous effect on the experience that the end user has when trying to use the compiler.

So, how long has it taken to get to this point? A long time. I think the first copyright on this compiler is around 2011. That's 6 years for 750 LoC. That's about 125 lines of code per year.

But that doesn't tell the whole story. If you look at the GitHub contributions that I've made, I've made 2967 of about 3000 commits to the compiler source over that time frame. In that time I've added roughly 4,062,847 lines of code to the code base, and deleted roughly 3,753,677 line of code. And there's the real story.

Bottom line? Getting to that point where you're doing more with less and keeping things as simple as they possibly can be, is really a lot of work. It means that for every one of those 750 lines, I've had to examine, rework, and reject around 5400 lines of code.

And that's not too shabby, I think.