I have read it's evolutionarily advantages to be more alert when fasting to assist with hunting and aquiring your next meal.
"that’s what we’re finding in lab animals — the brain and body actually perform better during fasting. In the case of the brain, cognitive function, learning, memory, and alertness are all increased by fasting. "