You probably aren't more productive, you just feel more productive in that you can sit and grind for a long time. I did a lot of practice programming where I measured myself, some things that would take hours when I was tired but I felt I was doing a lot of things took like half an hour when I was rested. However when I was rested I didn't feel that I accomplished much, it was just an easy task and then I moved on, while when I was tired I was feeling like I was moving mountains. Also code quality issues and bugs were much more common when I was tired.