Ask HN: What do you do during compilation?

2 points by chaghalibaghali ↗ HN
I'm currently working on a project that takes ~3 minutes to compile. Slightly too long to stare into space, but if I start reading an article then I invariably lose focus on the work I'm doing. Does anyone have any good solutions to this problem?

10 comments

[ 4.4 ms ] story [ 12.3 ms ] thread
Start to think how you can reduce your build time, there is a lot of approaches to reduce compilation time depending of your programming language and your environment.

I have seen huge compilation time improvement on C++ projects using different tips :

- use SSD to reduce link time

- distributed compilation on several hosts

- reduce amount of template to avoid world recompilation at each change

- ...

Can you add hooks to your compile process?

Write a program or script during those 3 minute breaks, just keep the project open in another window and switch to it whenever you're compiling, write a few lines and then go back to your work.

The program could query the YouTube API for short videos {duration: 'short'}, make a playlist sorted by popularity, remove the videos you've already seen and then auto-play them in an overlay/lightbox on your screen. The playlist should continue until the compile has finished, when it will notify you and return you to your work after the current video has ended. It would also need some way to return you to your work immediately if you don't want to watch (a key and mouse click), or perhaps a way to stop the script from launching in the first place.

And definitely open source it ;)

This is a great idea! Something to focus on for <= the amount of time the compile will take, without any opportunity to head off down a distractions rabbit hole.
Press ups work well for me - although, might not work so well in some office environments.
Start drinking lots of water.

But you could also spend every three minutes to try to speed up the build. Dependencies, compiling unchanged source, tests, etc. There are so many ways to speed this up. If that's not possible, maybe you can step back and think of something more creative.

What language are you using? There can be different strategies for different languages to speed up things.
How much can you do without compiling? One of my current projects involves a painfully slow SharePoint system. Actually building and deploying takes forever, but most pieces of code that I need quick feedback on can be built outside the main project then integrated later, which is much easier.

When I do need a full build, I make sure it is a single step run from the command line so I can go get a coffee while it runs.

Sure, actually speeding up the build would be better, but sometimes that isn't an option.