Compilation Time Is Eating My Soul Slowly

Filed under: Programming
Written By: Walter G.
Published On:

One of the main reasons that I'm a huge fan of JavaScript is because of it's ease of use. You open up notepad, you type, you save and you're done. The browser will instantly turn your mental output of zeroes and ones into a visual representation of some type. It's fun. But then, you have your back-end languages, which of course, require some form of translation or compilation or interpolation, or some combination of all 3. And so we wait. And we wait. And wait while we watch the gears turn in our applications. In the business world, this has turned into the gap in your work where you're forced to browse the web and it's become an acceptable practice.

Compilation Time Is Eating My Soul Slowly

And it's understandable. The engine, framework, compiler, interpreter is taking your entire project and converting into something that it can understand. Needless to say, it requires some atomic ticks of clock. But just how many ticks and how does that effect your overall output and creativity? Let's talk about that today.

Compi-wha?

Compilation is essentially the translation of your code into an executable version that a computer can understand. Think of it like ordering food on your favorite food-ordering app. You enter the commands, and food gets to your stomach at some point. Pretty magical. With code, you write your code, then you get a login system let's say. Also, pretty magical. But in between both of those things many many things had to happen. Someone had to read your order. Then that someone told someone else about it. That other person gathered the ingredients, built your meal, and send it on over through another someone.

food related parables

The same thing happens with code. Some other piece of code (Mike let's call him) will read your code and translate certain elements of it into something that the computer it's running on can understand. And this might be different, depending on the machine. x86, Linux, iOS, 64bit, 32bit..etc. And in the end, you end up with a result of some kind. A meal, if you will. Now that meal that be sent to a program to run it, for you to enjoy.

But all of this takes time . Not hours, like with food. But seconds. Many many seconds. And when you're a programmer, sometimes seconds aren't a luxury that you have. While the quartz crystal resonates another indication of time, your once clear thoughts about a solution to a problem begin to fade a bit. Then you make a change, and you compile again. And you do this over and over again, until your project stops making sense.

so what to do

Unless you're willing to transfer your entire project into a non-compileable language, then there isn't too much you can do. The end. Let's go home. Close up shop. Just kidding. There isn't much you can do from a technical standpoint. Compilation is compilation. It's like ordering pizza without delivery. It's weird. But there is something that you can do about how you code. For example, why am I compiling so much? Because it's like a nervous tick kind of. You fix a line and you want to see the result immediately. At least I do. It's a dopamine fix in a sense, just like how social media sites use likes and notifications to keep you constantly alert. You fix a line of code because "that has to be it!". But then it isn't. Over and over. It's gambling, in a sense.

So a good solution would be to mentally run through your code each time you need to make a change. To follow the logical steps as quickly as possible. If you're code is well setup, you'll be able to spot a bug faster than Dozer can spot an agent in the Matrix.

It's also good to get into the habit of doing something else, instead of doing nothing. The code for our company has grown considerably during the past 2 years. And with that, so has the TTC (time to compile). There's little we can do. Our compilations now can take up to a minute each time. So my compilation time is turning into some me time, in a weird way. A cup of coffee, a few notes here or there. A sketch, a doodle. Whatever it is. Just something that doesn't keep me staring at a spinning gear for 30-60 seconds. Turning that time into something productive, as oppose to something disruptive, like a light saber battle on a set of rolling chairs. The good old days.

Leave Your Comments