Caffeine is the most widely used psychoactive substance in the world, with polls indicating up to 90% of North Americans use some form of caffeine every day, half of them using over 300 milligrams (that's around 3-4 standard cups of coffee). Believe it or not, that leaves the U.S. still only 25th on the list of per capita coffee consumption, with Finland, Norway, and Iceland comprising the top 3 (maybe they need an extra boost during the months when the sun never sets). 

Daniele Wikoff, Ph.D., lead author of a scientific review published in Food and Chemical Toxicology, says, "After decades of research and thousands of papers, we know a lot about caffeine."

He's right. 

We know that 400 milligrams per day is considered safe for the average person. 

We know that men and women metabolize and react to it differently. 

Want more facts? Here are 71

But what we don't know is how to predict the specific amount of caffeine that would provide a desirable level of alertness based on how much sleep we got the night before. 

If you're anything like me, then up to now you've relied on the not-so-trusty old method of S.W.A.G. to decide when to cut yourself off -- in other words, you drink more than you need to, erring on the side of jittery but productive rather than relaxed but slothful. 

I should've said what we didn't know, until now

All thanks to U.S. Army research

You heard that right -- the U.S. Army's Medical Research and Materiel Command's Biotechnology High-Performance Computing Software Applications Institute (bet you can't say that 10x fast), has developed an algorithm for predicting effects of sleep deprivation and caffeine usage -- and the optimal consumption time. A smart move, considering that nearly half of service members sleep only 5 hours per night, and have a reliance on caffeine to get them back to peak alertness. 

One of the study's authors, Jaques Reifman, Ph.D., claims that "We can do simulations of thousands of combinations of when and how much caffeine to give. Then we pick the best solution."

Sometime in the next few months, the algorithm is expected to be released to the public in the form of an app (if you can't wait, check out this simplified model). When that happens, we'll be able to generate personalized data not only for how much caffeine will give us the edge in a given scenario but also when to consume it to produce optimal performance & cognitive effects. 

Sounds cool, right? 

Now just imagine where this road is leading -- syncing your coffee maker to a smartphone app that monitors your sleep activity and biomarkers, allowing it to produce the perfectly dosed cup at the perfect minute of the day. I can see it now...

Alexa: "Tom, based on your 5.5 hours of sleep last night, this is the right time for me to brew your coffee to yield optimal cognitive performance levels. Would you like me to make it?"