views:

677

answers:

13

Closed as an exact duplicate of this question.

When I write C++ code I compile frequently so that I can see that I'm not making a mistake or what errors to fix next.

However, that practice is unfortunately highly inefficient, especially with bigger projects that take a long time to compile. Even if compilation takes only 30 seconds or a minute it adds up to be a big waste of time over the day.

How do you deal with longish compile times? Do you just not compile often? During compile times, what works best for you as a time filler? Look at the code some more? But that can disturb the compiling process. Quickly switch to some other coding project you're working on? Read an article?

In terms of cognition it's quite an interesting question: How do you deal with frequent forced one-minute interruptions without losing your focus?

+4  A: 

Dude, chill out and surf the Internet

Chris Conway
+5  A: 
Yuval A
+4  A: 

I'm compiling right now; so what does that tell you ;)

I usually read the news, programming blogs and visit SO. Sometimes I go take a piss and grab a bite to eat. Depends on my mood really.

hmcclungiii
+2  A: 

I'll sometimes check email, RSS, StackOverflow, etc. when I have down time such as waiting for a compile. But I wonder whether it might actually be more productive to sit there and do nothing. Checking email keeps me busy, but it has the potential to derail my concentration. When I'm working on something really hard, I'll just sit there.

John D. Cook
+3  A: 

Answer questions on StackOverflow ;)

driAn
+9  A: 
Bill the Lizard
XKCD always applies to almost every question. They are the Jon Skeet of cartoons.
daub815
Looks familiar to me: http://stackoverflow.com/questions/55922/how-to-keep-concentrated-and-focused-while-waiting-for-your-compiler#55928 ;-)
splattne
First thing that came to my mind!
phsr
@splattne: Crap! Now I have to vote to close. :(
Bill the Lizard
Helpful joke, right?
hmcclungiii
A: 

I make a small windows with a terminal (windows on top) and surf the internet while checking for compile errors or warnings, that way I know when to stop surfing. I also listen to some 8bit tracks in last.fm

If the project compiling is small I just wait.

note: I'm the only one with a slow machine here?

Movaxes
+1  A: 

I would use the time for ordering a faster machine.

splattne
+4  A: 

Sword fight!

http://www.nniling.us/303/

But seriously, have you gone through all lengths to ensure your compile time is as fast as it can be?

  1. Have you upgraded you RAM? I recently moved to 4 GB of RAM and it cut down 30% of compile time.
  2. Can you build different parts of your codebase separately? I currently have a setup where if I only make an edit to the model layer, that's all I have to compile. This approach can increase your efficiency significantly.

Work on reducing your compile time before you decide how to spend your extra cycles.

Zakir Hemraj
+1  A: 

Partition your code so that most compiles are very fast (ideally only 1 or 2 seconds). Only on rare occasions should you have to wait on your compiler.

Long compiles are not simply a waste of time. They also break your concentration and act as a barrier that may discourage experimentation and testing.

What I meant to convey here was that during slow builds, I inevitably start thinking about how to fix my company's build system (even though it is just a pipe dream for me). I really can't comprehend why people think slow builds are acceptable. There must be a better way -- if you apply a little creativity.
nobar
A: 

I always spend that time looking for duplicate questions on Stackoverflow:

How to keep concentrated and focused while waiting for your compiler?

splattne
This theme is worth varied exploration. [My build started about an hour ago]
nobar
+2  A: 

Fix my build process.

A: 

Spellcheck my comments and add documentation

Fortyrunner