for me it depends on what I'm doing. if its something creative then i find I get better results late at night. if its more technical then early in the morning.
the quote from hemmingway "write drunk, edit sober" comes to mind, if you replace drunk with tired