I get 7-8 hours of sleep per night, then work until I run out of energy, then go to bed and sleep until I'm recharged. This leads to ~29 hour days, if uninterrupted by errands/social obligations, but it can be extremely productive.<p>One of the first lessons that I learned when I went into full-time startup mode was that I got a lot more done if I didn't work when I didn't have energy or focus. Tired at 2PM? Go sleep. Can't seem to focus? Go for a run, or play a video game for a half hour, or go read a book. Do something that doesn't require focus and concentration, but which keeps your mind off of work. When I'm at the computer and working, if I listen to my mind and body, I can achieve insane productivity when I'm actually working. I tend to have more productive time as a result, too, though sometimes it feels "wrong" to work for a half hour then go take a two-hour break, but when I come back I blast through problems in 10 minutes that would have taken those past two hours otherwise.<p>The trick isn't to just throw more butt-in-chair time at the problem, but to make sure that when you're working, you're productive. If you find yourself playing Flash games, browsing Reddit compulsively, or checking your email for the 15th time in 45 seconds, get up and go nap or refocus. When you come back, you'll be recharged and it'll be far easier to get back into the groove.<p>I firmly believe that the 8-hour 9-5 workday is a terrible thing to do for programmer productivity. If you have the flexibility in your schedule to allow for it, learn to ignore what society has programmed into us as the "right" work schedule and learn to work when you can be productive, and to not even bother when you can't.<p>I drink a <i>lot</i> of coffee, and its effects on my mental clarity are very easy for me to observe, but I've learned to recognize when I'm going to be winding down, and I stop drinking it ~4 hours before I expect to go to bed. If I don't, I end up exhausted and wide awake in bed, which utterly sucks.