A few nights ago,I got jazzed-up on the Vietnamese Iced Coffee I'd had with dinner, and I literally coded all night and into the daylight. I probably started around 8PM and ended around 9AM, working on my hobby project.
And honestly, if I hadn't been jazzed up, I would have stopped somewhere around 1:30AM, to my own great benefit. By the end I was spending half my available effort just staying awake and remembering how my code is broadly structured.
If I'd had to do something other than cycle through compile-run-debug, I would have failed completely. No matter your caffeine or passion levels, at some point you lose sanity points and Cthulhu arises from the depths to eat your code and then your soul.