Smaller Code, Better Code

tosh1 pts0 comments

Smaller code, Better code

Login

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.

You might also like...

Mar

29

Computing on Indices

I received this inquiry from Daniel Lyons, and I wanted to post my response here, since this is a favorite

Mar 29, 2025

9 min read

Sep

14

Speaking at LambdaConf 2024 (May) [Limited Time Discount code]

I'll be speaking at LambdaConf 2024 in May. We haven't finalized the exact talks that I&

Sep 14, 2023

Apr

21

Flat Program Organization: An Email Response

A fellow APLer, Tort, started an interesting email discussion with me, and one of his points was good enough that

Apr 21, 2023

7 min read

Mar

21

Thesis Correction: Sec. 3.7, Guard Lifting

I was thankfully informed by Douglas Mennella that the before and after diagrams for section 3.7 of my thesis

Mar 21, 2023

1 min read

Dec

20

Co-dfns support for very large arrays!

Previously, Co-dfns could only support ranks

Dec 20, 2020

1 min read

code compiler before ever time lines

Related Articles