In his best-seller Why We Sleep, sleep scientist Matthew Walker breaks down how to know if you're getting enough rest and when to stay (and leave) your bed. Sleep also ties directly to your memory.

In short, the less you sleep, the less likely you will keep a positive habit.

The crucial two hours

According to Why We Sleep, a full-night's sleep is split into two distinct parts: the first half is REM sleep and the second half non-REM sleep. We need both to recharge our body as well as rest our mind.

The veteran scientist says that at least eight hours is best for everyone except for a very small (less than 1 percent) segment of the population. Why? With us eight-hour folks, the last two hours of sleep solidify our observations from the previous day.

According to Walker's cited studies, people who were taught a new habit or language were significantly less likely to remember it the following day if they got six hours or less of sleep than those who got a full night's sleep. In some cases, Walker says, it was like they didn't study anything at all. (One scientific study was actually done on college students, proving that it's better to get a good night's sleep than to cram all night before an exam).

By waking up early, we don't get a chance to fully process what we learned the following day. It's like getting a half night's worth of sleep--whether you get four hours or six hours.

The final two hours are when the magic happens.

Ways to get better rest

I have spent recent years raising my two small children while founding two startups. I know how unrealistic it can be to demand eight hours in your life. However, Walker gives solid advice for improving the sleep you actually can get.

First, try to be consistent. You may not be able to control what wakes you up in the night or when you wake up in the morning, but you may be able to decide when you go to bed. I usually go to bed within the same hour timeframe, and, over the years, my body automatically begins to relax during that time every night out of habit.

Second, drop the caffeine close to bedtime. I've grown to love a consistent coffee sip from late morning all the way to dinnertime, but Walker says to drop the caffeine several hours before you get in bed. Even if, like me, you feel fine, the internal hyper response to caffeine will keep you from getting deep sleep--meaning you won't get the bilateral rest your body needs to absorb any lessons from the previous day.