The next time you feel like squeezing in a power nap after a bad night of sleep, maybe consider a short exercise workout instead.

New research suggests it can effectively balance out the dip in cognitive function caused by a restless night.

The study, led by researchers from the University of Portsmouth in the UK, reveals some interesting new insights into how exercise benefits our bodies – including when oxygen is at a premium.

Two experiments were run, with 12 healthy adult participants in each. One tested cognitive performance after three nights of partial sleep deprivation (PSD), and the other after one night of total sleep deprivation (TSD) in a state of hypoxia (low body oxygen), compared with banking a normal amount of sleep.

Several interesting findings emerged, key among them that 20 minutes of work on an exercise bike improved brain function in all conditions: PSD, TSD, and hypoxia. That's useful to know for a wide range of people, from new parents to mountain climbers.

"We know from existing research that exercise improves or maintains our cognitive performance, even when oxygen levels are reduced," says exercise physiologist Joe Costello from the University of Portsmouth.

"But this is the first study to suggest it also improves cognitive performance after both full and partial sleep deprivation, and when combined with hypoxia."

The link between exercise and brain boosts is already well established, but this study gives researchers some useful extra evidence.

For example, it's thought that one of the reasons that exercise and brain power are linked is because it gives the brain extra oxygen – but here there were still cognitive improvements in low oxygen environments.

That in turn suggests other factors, such as brain-regulating hormones, could be involved, or perhaps increased arousal and motivation.

Further studies will be needed to take a closer look, but we now have some helpful new information about sleep, exercise, and thinking ability, because several stressors were tested at once.

"Sleep deprivation is often experienced in combination with other stressors," says physiologist Thomas Williams, from the University of Portsmouth.

"For example, people who travel to high altitude are also likely to experience a disruption to their sleep pattern."

Research suggests around 43 percent of us don't get the recommended 7-9 hours of sleep per night. That has consequences when it comes to the risk of everything from depression to heart disease, affecting most aspects of our physical and mental health.

What's encouraging is how quickly we might be able to reset ourselves and reverse these negative effects – although it's clearly preferable to bank enough sleep every night to begin with, rather than try and catch up.

"The findings significantly add to what we know about the relationship between exercise and these stressors, and help to reinforce the message that movement is medicine for the body and the brain," says Costello.

The research has been published in Physiology & Behavior.