I've found that if I wake up with less than 7-9 hours of sleep, that I get really tired around 4-6pm or so and I end up having to take a nap. I've stopped using an alarm clock and I just get up when I wake up by leaving the blinds open and letting the sun wake me up.
I've been using Sleep Cycle (iPhone app). It's 99c and if you don't mind sharing the bed with your iPhone it's pretty much the same thing. I can't say it's my favorite app in the world just that it's well worth the 99c.
I try to get at least 7, preferrably 8, but not more than 9. Any more and I feel tired for the rest of the day. Less, and I don't feel like my mind is as sharp as I'd like. Left to my own devices, I don't get very much done at either end of things.
I can work with too much sleep, if I have something that needs doing. But with too little, I find that the code I write isn't very good and wind up rewriting it later on. I write better code after a few drinks than when I haven't had enough sleep, for example.
I try to get 9 (I heard that's healthy, or something...) but average around 7-8. Sleeping feels so good, but so does working. What a lovely zero sum game.
I am most alert if I get 5-6 hours of sleep, eat a minimal amount, and take a 30min nap around 2pm. Most days I don't need to take a nap.
If I sleep more than 7 hours, I am tired all day. If I eat too much I need a long nap.
If I am up late all weekend hacking, partying, or playing games, getting may 8 hours of sleep for the entire weekend, I may need to catch up for a week or two after that with 7 or 8 hours of sleep a night.
I really try to do around 6 on weekdays and as close to 8 or better as I can on the weekend.
6 During the weekdays is an optimal number for me, as it allows me to get in to work early (7:30 or so) and leave and a decent time (5:30) to sync my schedules with my fiance who works 8-4 and then I can have supper and relax a bit and then have time to do some work if necessary before I go to bed at ~12-12:30
It depends on whether you work full time, part time, working for yourself or doing nothing. I imagine full time people try to maximise their spare time, so reduce their sleeping time and effectively turn into zombies.
I have a weird sleeping time, i find out that from 12am to 8am i'm more productive coder, maybe because all the people are sleeping and i'm not get distracted easily.
To me, which hours I get are even more important than how many hours. Even shifting my pattern by an hour or 2 usually makes me less alert the next day.