You already know the feeling: You've had maybe four hours of sleep, you've got a full day ahead of you, and coffee is only going to get you so far.

Do you squeeze in a nap, or push through with a workout instead?

A new study published in Proceedings of the National Academy of Sciences suggests that, when it comes to your memory, a nap and a 20-minute workout may actually have a similar impact.

Researchers from McGill University in Canada kept 54 healthy young adults awake for a grueling 30 straight hours under lab conditions, then split them into three groups.

One group got 20 minutes of exercise, in the form of moderate-to-vigorous cycling. Another got a 90-minute nap. A third group sat on a stationary bike for 20 minutes without pedaling, as a control.

Athletes engaged in a high-intensity indoor cycling session
A 20-minute workout may have a similar impact as a nap when it comes to your memory. (Dmitry Limonov/Pexels)

Shortly after, everyone was shown a set of images with no instruction to memorize them – then, three days later, they were tested on which ones they could actually recognize.

Both the nap group and the exercise group remembered significantly more than the control group.

Nearly identical amounts, in fact: 23 percent better recognition for the nappers, 21 percent better for the exercisers, compared to the control group.

Statistically, the two interventions showed no meaningful difference.

This study reflects a 2023 University of Portsmouth study that found 20 minutes of moderate cycling improved cognitive performance in people who'd been partially or fully sleep-deprived, even in low-oxygen conditions.

But here's the part that makes this new study interesting – the researchers also recorded participants' brain activity using electroencephalography (EEG). They found the two groups got to the same result through what looks like completely different neurological routes.

A cap holding electrodes in place on the top of a person's head, with eyes and nose visible
A cap holds electrodes in place while recording an EEG. (Tim Sheerman-Chase/Flickr/CC BY 2.0)

In the nap group, the team saw markers of reduced sleep pressure and fatigue in the brain, such as slow-wave activity easing off. It was as though the 90 minutes had genuinely bought back some lost rest (which makes sense as they had slept more).

The more that fatigue signature dropped, the better people remembered the images afterward.

The exercise group showed almost none of that. Their fatigue markers looked similarly elevated to those of the control group that did nothing at all – the workout didn't make them feel any less tired.

Instead, their memory boost tracked with a completely different set of signals, ones linked directly to how efficiently their brains processed the images in the moment of viewing them.

In other words: the nap rested the brain. The exercise didn't rest it – but it seemed to make it work better anyway.

"Sleep loss affects nearly every aspect of how we think and function, but many people can't simply stop what they're doing and get more sleep," says Marc Roig, the study's senior author and a sports scientist at McGill's School of Physical and Occupational Therapy.

"Our findings show that even a brief bout of exercise may help preserve one of our most important cognitive abilities."

That distinction particularly matters for people who don't get to choose.

Many people who most need this – nurses, pilots, new parents, anyone on a night shift – can't exactly duck out for a nap mid-shift, as neuroscientist Madhura Lotlikar, the study's first author, points out.

Subscribe to ScienceAlert's free fact-checked newsletter

"Exercise is accessible, inexpensive, and easy to implement. That makes it a promising tool to help people stay cognitively sharp when sleep is limited," explains Lotlikar.

None of this makes either option an ideal replacement for a decent night's sleep. The researchers make it clear that both a workout and a nap are stopgaps, not substitutes – useful for getting through the day you're already stuck with, not a long-term strategy for running on less rest.

Which is important, because an estimated 20 to 40 percent of adults worldwide already aren't getting enough sleep, a shortfall RAND has estimated costs the US, UK, Germany, Japan, and Canada a combined $680 billion a year in lost economic output.

Related: First-of-Its-Kind Study Shows Just One Extra Hour of Sleep a Night Raised College Students' Grades

So next time you're staring down a day on four hours of sleep: if you can nap, napping could be the most helpful.

If you can't, a brisk 20-minute walk or cycle may be more than a distraction from how tired you are – it appears to be doing something real for your brain, whether or not it makes you feel any less exhausted.

The research has been published in the Proceedings of the National Academy of Sciences.

This article was fact-checked by Rebecca Dyer and edited by Rebecca Dyer. While we pride ourselves on our process, we are only human. If you spot a mistake, please let us know.