I have always been envious of people who can get by with only six hours' sleep. I prefer eight, sometimes more. I can function on six, but after a few days my brain will be way below full capacity.

How much sleep we get affects us all. Too much sleep makes us groggy and disorientated. Sleep too little and our mood and concentration suffer. If this carries on it can also cause serious health issues, heightening the risk of diabetes, obesity and high blood pressure.

Most of us sleep between six to nine hours a night, meaning we spend about a third of our lives asleep. This may seem like a long time, but we actually sleep the least among all the primates – the group that includes monkeys, apes and us.

So says a new analysis looking at the impact sleep has had on our evolution. The new research suggests that humans have evolved to sleep less, but also to sleep very deeply. This may help explain our success as a species.

Three million years ago, our ancestors still had ape-like bodies. These Australopithecines probably slept in the trees, like modern chimpanzees.

We do not have direct evidence that H. erectus used fire at this time

But by two million years ago, hominins had become fully upright. Homo erectus spent its life on the ground, and may have been the first hominin to make beds there. If that is true, we have been sleeping on the ground for a long time.

Sleeping on the ground may have gifted H. erectus with a higher-quality, more restful sleep.

For one thing, they did not have to worry about falling out of the trees. What's more, while the risk from predators was higher on the ground, they had ways to protect themselves.

In particular, H. erectus may have mastered the use of fire. The flames and smoke would have scared away both mosquitoes and larger predators, keeping them safe. They may also have hidden away in sheltered places like caves.

We do not have direct evidence that H. erectus used fire at this time. But 10 years ago, Richard Wrangham of Harvard University proposed that our ancestors must have eaten cooked food to get enough calories to fuel their bigger brains.

As BBC Earth has covered before, fuelling our energy-hungry brains with enough calories has been crucial to our evolution. If our ancestors did not cook, Wrangham argued, they would have had to spend too much time chewing and digesting.

There is also evidence that at the same time hominins came down from the trees, they became smarter and acquired better weapons.

H. erectus was starting to build better tools. Technologies like the Acheulean hand-axes pictured above were more advanced than older stone tools. This knowledge was widely shared, so they must have learned it quickly.

Although we sleep for fewer hours than other primates, the sleep that we have is of high quality

Group sizes also increased around this time, perhaps aided by better weaponry and communication skills.

According to David Samson and Charles Nunn of Duke University in North Carolina, US, all these changes – from larger groups to more advanced tools – can be linked to a change in the way our ancestors slept.

They have set out their ideas in a new study published in the journal Evolutionary Anthropology.

They argue that moving from the trees to the ground allowed our ancestors to sleep more deeply – "which could in turn have affected cognition", says Samson.

The theory goes that although we sleep for fewer hours than other primates, the sleep that we have is of high quality so we do not need as much.

To understand whether human sleep is unique, Samson and Nunn compared the sleep patterns of 21 primates, whose slumber patterns had already been analysed.

Humans therefore have the deepest sleep of any primate

As well as noting how long the animals slept for, they looked at how much time they spent in rapid-eye movement (REM) sleep. This is when we dream, and when our brain consolidates our memories into long-term storage.

Humans slept the least. The sleepiest primates were grey mouse lemurs and night monkeys, which slept for 15 and 17 hours respectively.

But in contrast, humans spent the highest proportion of their sleep in an REM state: almost 25%. "Humans therefore have the deepest sleep of any primate," says Samson.

Other primates get much less REM sleep, between 5-10%.

Samson previously compared ape and monkey sleep, and found a similar pattern: apes seem to have better-quality sleep than monkeys.

You need to have a unique sleep environment to be able to pull this off

This may be because apes sleep in specially-built nests in the trees. Monkeys do not, and their environment is often less secure. That means they have to sleep more lightly, allowing them to wake quickly if a predator approaches.

Just as apes get better sleep than monkeys, so we get better sleep than apes. "From an evolutionary perspective, just as the transition from tree branches to sleeping platforms had adaptive benefits, so too did the early hominin transition from sleeping platforms to secure ground sleep," Samson previously told BBC Earth.

He argues that we could not have slept so deeply until we found ways to sleep safely. During REM sleep, you are "essentially as close to dead in the outside world as you'll ever be", says Samson. "You need to have a unique sleep environment to be able to pull this off."

The idea that humans have evolved to sleep briefly but deeply runs counter to a cherished folk belief. Surely modern technologies like artificial lighting have disrupted our natural sleep patterns? Isn't that why we are all so sleep-deprived?

Surprisingly, this may not be entirely true.

Getting less sleep did not appear to reduce their cognitive abilities

A study published in November 2015 looked at the sleep habits of three preindustrial societies: two hunter-gatherer groups from Africa and one horticultural group from Bolivia.

All three groups slept for an average of 6.4 hours per night, ranging from 5.7–7.1 hours. That is even less than the average for an industrial society.

The people in the study woke before sunrise and went to bed several hours after sunset, suggesting that the natural light and dark cycles were not determining when they went to sleep.

What's more, getting less sleep did not appear to reduce their cognitive abilities, and they were all generally healthy, says lead author Jerome Siegel of the University of California, Los Angeles in the US. This suggests they were sleeping enough.

Siegel's study does not tell us anything about ancestral species like H. erectus. But it does suggest that the earliest modern humans, who lived in similar environments to the people in the study, also needed surprisingly little sleep.

It is tricky to be sure about this, because some people need more sleep than others. There could even be population-level patterns: certain groups of people may have inherited genes that allow them to get by on less sleep.

REM sleep is very important in the development of the nervous system

Samson and Nunn's study focused on average amounts of sleep, taken across entire populations. But that might be missing the point, says sleep specialist Jeffrey Durmer of Georgia State University in Atlanta, US.

Sleep is particularly important when we are very young, especially REM sleep. Infants spend far more time in REM sleep than children or adults.

If you compare a child's REM sleep to that of an adult, the difference is much greater than it is between humans and chimpanzees, he says. This might mean that getting enough quality sleep early on in life was more important in helping our ancestors develop into ever big-brained hominins.

"REM sleep is very important in the development of the nervous system," says Durmer. "That means that cognition in particular is ultimately very reliant on REM sleep."

Siegel thinks that REM sleep is not that important to humans after all

The biggest problem with Samson and Nunn's idea is that we do not yet understand all the functions of sleep, so we cannot say for sure what benefits we might get from extra REM sleep.

In particular, we periodically switch from REM sleep to other kinds of sleep. We do not know why these transitions happen, or how important they are, says Derk-Jan Dijk of the University of Surrey in the UK. "There may be a little secret there."

The picture gets even muddier when we start to compare our own REM sleep to that of other animals, beyond our close relatives the primates.

Siegel thinks that REM sleep is not that important to humans after all.

He argues that we should consider all mammals, not just primates. When we do so, humans do not stand out as needing a particularly large proportion of REM sleep.

We may have a very different use of REM sleep compared to other species

The link between REM sleep and intelligence also fades away. For example, dolphins are intelligent and have large brains, yet they do not need any REM sleep. Meanwhile opossums, which are not noted for their deep thinking, need over six hours.

Samson disagrees. He points out that species' distinct lifestyles can result in differing needs for sleep.

Famously, dolphins only sleep on one side of their brain at a time. The reason for this is simple: if they switched off completely they would drown. Looked at in that light, it makes sense that dolphins do not sleep deeply.

"When you use animal studies to compare to humans we aren't comparing apples to apples," agrees Durmer. "We may have a very different use of REM sleep compared to other species."

Regardless of why it happened, the fact remains that human sleep is strange compared to our closest living relatives. This suggests that we have evolved to need less of it.

Obviously, we cannot ever study how long our hominin ancestors slept for, because they have gone extinct. The best we can do is to compare ourselves to other living animals.

It seems that, at some point, bigger-brained hominins became more efficient sleepers. The bad news for above-average sleepers like me is that we may be genetically predisposed to need more of it.

But the third of our lives we spend doing so is certainly not wasted. Our big brains took millions of years of evolution to get there, so it's only fair that we reward ourselves with a lifetime of adequate rest.

Melissa Hogenboom is BBC Earth's feature writer. She is @melissasuzanneh on Twitter.

Follow BBC Earth on Facebook, Twitter, and Instagram