More interestingly still, it doesn't have any cognitive effects at all unless you're sleep deprived. It also doesn't have any cognitive effects in the morning. So that coffee people drink in the morning to wake up, that's just a placebo (unless they slept less than 6 hours, then it helps a bit).
But it does have a bunch of physical effects. Like increased blood flow to the brain, which helps with various things regardless of the fact that blocking adenosine receptors is doing jack shit. It also increases your stamina and physical strength. Which can be useful. Also why a lot of sports bars and most flu medicine contain a bunch of caffeine.
I write about this a lot in my book about Why programmers work at night: https://leanpub.com/nightowls (shameless plug :))