|

39 min read

Sleep On It: The Engineering Case for Better Rest

A few months ago I read a book called Why We Sleep by Matthew Walker, a neuroscientist who runs the Center for Human Sleep Science at UC Berkeley and has published over a hundred peer-reviewed papers on sleep. I love reading about health and wellness, and the more I got into this one the more I realized how much of it can be applied to the work done at SEP. Walker makes some really big claims in his book, and as an engineer and a naturally curious person I didn’t want to just take his word for it. I went and looked at the actual research behind the claims. I found a lot of it is backed by solid, well replicated science. Admittedly, some of it is overstated, and I’ve tried to flag where I’m confident and where the picture is messier. I am also citing the primary studies at the end of this post so you can go look for yourself.

Most people already know sleep is important. But knowing something is good for you and actually understanding why it’s good for you are very different things. You’re way more likely to change your behavior when you understand the mechanism behind it. That’s the gap I want to help close. The research has real implications for how we work and live. The quality of the code we write, the decisions we make in design reviews, how we show up in meetings, how often we get sick, and how we feel outside of work are all impacted by sleep. Understanding this stuff can make each of us better at our jobs, it can make SEP better as a company, and it can help us be our best selves in life in general. That’s what I found compelling, and that’s what I want to share. By the end of this post I’m hoping you’ll think about sleep a little differently.

These are the three things I want to cover: why we sleep in the first place, why we should prioritize sleep, and how you can improve your sleep.

Why Do We Sleep At All?

Why do we sleep? It sounds like a dumb question. We sleep because we’re tired, right? But if you actually think about it, sleep is one of the weirdest things we do. We spend roughly a third of our lives unconscious. If you live to 90, that’s 30 years. And during those 30 years you can’t eat, you can’t work, you can’t defend yourself. For our ancestors, being unconscious for 8 hours every night was a massive liability. Try to think about it from the perspective of natural selection. Nature is ruthless. If a trait reduces your chances of survival, it gets filtered out over time. If sleep were just “nice to have,” natural selection would have found a way to reduce it or get rid of it entirely over millions of years. Except it didn’t. Every animal that scientists have studied sleeps in some form. The fact that sleep has been preserved across basically all of animal life, despite how costly and dangerous it is, tells us something really important: sleep is not just helpful, it’s essential. There’s something happening during sleep that is so critical that natural selection decided the risk of being unconscious for a third of our lives was worth it.

So what is sleep doing that’s so important and how can we do it better? That’s the question I want to answer for the rest of this post. Everything we’re going to cover is part of the answer. But before getting into what sleep does, I want to explain something most people have never been taught which is how tiredness actually works.

Why We Get Tired: The Two Systems

There are two systems running in your body that determine how tired you feel at any given moment.

The first one is your circadian rhythm. You’ve probably heard that term before. The word literally comes from Latin. Circa means “about,” dies means “day.” So circadian just means “about a day.” You have a clock in your brain that runs on roughly a 24 hour cycle, and it’s ticking whether you’re aware of it or not. And here’s what’s interesting: this clock is internal. It doesn’t need sunlight or a watch to run. A French researcher named Michel Siffre actually proved this back in 1962 by going and living in an underground glacier cave in the Alps for two months. It was total darkness with no time cues, and his body still held to a rhythm close to 24 hours [1]. His body clock drifted to roughly a 24.5 hour day, about 30 minutes longer than a real day. Without any input from the outside world, his body still ran on something close to the same clock we all live by. The big takeaway from this study is that natural light isn’t just a pleasant thing to experience. It’s a form of feedback that keeps our internal clocks synchronized with the physical world. Without natural light, your internal clock will start to drift.

The second system is sleep pressure. The longer you’re awake, the more a chemical called adenosine builds up in your brain. Think of sleep pressure/adenosine accumulation like a weight that gets heavier and heavier throughout the day. When adenosine binds to the receptors in your brain, you feel tired. And when you sleep, your brain clears the adenosine. That’s one of the core jobs of sleep, you wake up with a clean slate.

So those are the two systems: circadian rhythm and sleep pressure. The two systems work against each other. Your circadian rhythm is really a wake drive, it pushes you toward alertness. Sleep pressure pushes you toward sleep. A good proxy for how tired you feel at any moment is the gap between the two: sleep pressure minus the circadian wake drive. When sleep pressure is high and the circadian wake drive is low (late evening, after you’ve been awake all day) the gap is huge and you feel very sleepy. But when the circadian wake drive is strong and sleep pressure is lower, you feel more awake and alert. Figure 1 makes this dynamic visible. Sleep pressure (solid red) climbs throughout your waking hours and resets during sleep. The circadian wake drive (dashed blue) oscillates with its peak in the late afternoon. The vertical gap between the two curves is roughly how tired you feel at any given moment. At bedtime that gap is enormous, which is why your eyelids feel impossibly heavy.

Figure 1: The two-process model. Sleep pressure (Process-S) and the circadian wake drive (Process-C) interact, and the gap between them is a proxy for how tired you feel.

Here’s a quick example of these two systems in action. If you’ve taken an overnight flight and landed in the morning, you might recall feeling oddly more awake than you expected even though you barely slept. Your sleep pressure is enormous after a sleepless night, but when you land at 9am, your circadian wake drive is hitting its morning peak which narrows the gap between the two curves. You still have massive sleep pressure, but the wake drive is partially counteracting it. Obviously it doesn’t last, but it’s a real effect, and most people have felt it without knowing why.

A quick sidenote about caffeine, because this is the part a lot of people don’t know. Caffeine doesn’t actually give you energy. What it really does is block the sleep pressure chemical, adenosine. Caffeine is structurally similar to adenosine, so it binds to the same receptors in the brain that adenosine does. It basically sits in the parking spot and blocks adenosine from parking. The “I’m tired” signal can’t get through, so you feel more awake. Unfortunately, caffeine doesn’t clear the adenosine. Instead, it just temporarily blocks it. The whole time the caffeine is active, adenosine is still building up behind the blockade. And when the caffeine eventually gets metabolized and clears out of those neuroreceptors, all that built up adenosine starts to flood back. That’s the caffeine crash. You don’t just go back to where you were, you actually feel worse, because more adenosine accumulated while you weren’t feeling it.

And here’s the math that is really important to understand. Caffeine has a half-life of 5 to 7 hours depending on your metabolism, with the average being about 6 hours [2]. So if you have a coffee at 8am, half of that caffeine is still in your system at 2pm. A quarter of it is still there at 8pm. If you have coffee at 2pm, half the caffeine is still active at 8pm, a quarter at 2 in the morning. You may not feel the caffeine since you’re not buzzing, but it is quietly blocking the signal your brain needs to fall asleep and stay asleep. Figure 2 shows the decay curve for a single 100 mg cup of coffee at 8am. Even at 8pm, twelve hours later, you still have 25 mg in your system.

Figure 2: Caffeine concentration over 18 hours from a single 100 mg cup of coffee at 8am, assuming a 6 hour half-life.

What Actually Happens When You Sleep

A lot of people think of sleep as a uniform process. You’re either asleep or you’re not. But it turns out sleep has a very specific structure. Your brain moves through four distinct stages, and each one is doing something very different.

NREM Stage 1 (N1) is when your brain slows down. Your muscles might twitch. You’re easily woken. This stage is basically just the doorway into deeper sleep.

NREM Stage 2 (N2) is where you spend about half the night. This is where your brain starts actively consolidating memories and filtering out noise so you stay asleep. It doesn’t get a lot of credit, but it’s doing a lot of real work.

NREM Stage 3 (N3) is also called deep sleep or slow wave sleep. This is arguably the most physically restorative stage. This is also when your brain is doing its heaviest memory consolidation. It is taking everything you learned during the day and moving it from short term storage into long term storage. The part of your brain responsible for short term memory is called the hippocampus. Think of it like RAM. It is fast, temporary storage that holds the day’s experiences. The part of your brain that stores long term memories is called the cortex. It’s like your flash/SSD memory since it is slower to write, but persistent and high capacity. NREM stage 3 deep sleep is the nightly save operation. Your brain flushes the hippocampal memory (RAM) into long term cortical storage (flash/SSD) and clears the buffer for tomorrow. If you don’t get enough deep sleep, the save doesn’t complete. You wake up with less RAM and less room to learn. This stage of sleep is also when your body releases the majority of its growth hormone for things like muscle repair, tissue recovery, and immune function.

REM stands for rapid eye movement. Your brain is nearly as active as when you’re awake, but your body is essentially paralyzed. The brainstem actively shuts down your voluntary muscles so you don’t physically act out your dreams. Dreaming happens almost exclusively in REM. And beyond dreaming, this stage is doing critical emotional processing. It is replaying and working through emotional memories, and making creative, associative connections between things that your waking brain wouldn’t normally link together. Sometimes that muscle shutdown during REM breaks down in one of two directions. If you’re dreaming but the muscle shutdown fails, you get sleepwalking. Your body acts out what your brain is experiencing. If the opposite happens, you wake up but the paralysis lingers, that’s sleep paralysis. You’re conscious, eyes open, but you can’t move. People often hallucinate a presence in the room or a weight on their chest during sleep paralysis. Researchers now think this is the most likely explanation for centuries of alien abduction and demonic visitation reports across cultures.

Now how do scientists actually know what stage of sleep you’re in? It comes from something called EEG, electroencephalography. Basically electrodes placed on the scalp that pick up the electrical activity from your brain. And what researchers found is that each sleep stage has a completely different brainwave pattern. You can literally see consciousness change on the readout. When you’re awake, the waves are fast and chaotic. As you drop into deep sleep, they slow into these big, rolling waves. Then when you hit REM, they snap back to fast again. During REM, your brain looks almost like it’s awake, even though you’re asleep. The point is that these stages aren’t just philosophical categories. They’re measurable, reproducible, distinct brain states. When a researcher says “this happens during REM” or “this happens during deep sleep,” they mean something specific and verifiable. Figure 3 shows what this actually looks like. The top panel is 30 seconds of deep sleep (Stage N3) from an overnight polysomnography recording in the Sleep-EDF database [3]. You can see the big, slow, rolling delta waves that define deep sleep. The bottom panel is 30 seconds of REM sleep from the same subject the same night, and it looks completely different. The amplitude is much smaller and the waves are fast and mixed. If you did not know any better, you might think this was someone who was awake. EEG also tells us about sleep quality, not just sleep stages. In healthy sleep, those slow waves in deep sleep are big and regular. When sleep is degraded by stress, alcohol, or aging, the slow waves shrink both in amplitude (each wave is shorter on the readout) and in density (fewer of them per minute).

Figure 3: Real EEG of Stage N3 deep sleep (top) and REM sleep (bottom) from the same subject’s overnight recording. Stages confirmed from the hypnogram annotation file. Data: Sleep-EDF Database Expanded on PhysioNet [3].

Your brain cycles through these four stages in roughly 90 minute loops. During one cycle, you typically move through lighter sleep (N1, N2), down into deep sleep (N3), back up through lighter sleep (N2), and then into REM. Then the whole cycle repeats. Over a full night you’ll go through about 4 to 5 of these 90 minute sleep cycles. One important thing to notice is how the cycles aren’t all the same. In the first half of the night, your cycles are dominated by deep sleep. In the second half, the cycles shift, and they become dominated by REM. REM periods get longer and longer as the night goes on. Figure 4 makes this visible. The deep sleep dips at the bottom are concentrated in the first two cycles. By cycles 4 and 5 there’s almost no deep sleep at all, just stage 2 alternating with long REM periods.

Figure 4: Sleep architecture across one night. Five 90 minute cycles between 11pm and 7am, with deep sleep front-loaded and REM dominating the second half.

What this means is that the timing of your sleep matters, not just the total number of hours. Sleeping from 11pm to 3am gives you 4 hours, but it’s mostly deep sleep. Sleeping from 3am to 7am is also 4 hours, but it’s mostly REM. They’re doing completely different things for your brain. And this is why cutting your sleep short, even by just an hour or two, is worse than people realize. If you normally sleep 8 hours but you cut it down to 6, you’re not losing 25% of every stage evenly. You’re disproportionately losing REM, because REM lives mostly in those final cycles. It’s not a clean, linear loss.

What Sleep Deprivation Does to the Brain

We see how sleep is broken up into distinct stages, but what happens when you don’t get enough of it. Before we dig in, a quick note on what counts as sleep deprivation. The consensus from the American Academy of Sleep Medicine and the CDC is that adults need 7 to 9 hours per night. Six hours or less is the threshold where measurable cognitive decline starts to show up in the research, which is why so many studies use it as their cutoff for sleep deprivation. Six to seven hours is a gray zone where most people are still underperforming but not generally considered sleep deprived. Seven hours and up is where most people are functioning well, although seven is the floor, not the target. The actual amount varies person to person, and plenty of people need 8 or 9 to feel their best. More sleep is almost always better than less.

Let’s talk now about what sleep deprivation does to the brain. There’s a study out of the University of Pennsylvania where a group of researchers took healthy adults and restricted them to 6 hours of sleep a night for two weeks straight [4]. By the end of those two weeks, their cognitive performance had declined to the level of someone who hadn’t slept at all for two full days. Their reaction time, their working memory, their ability to focus were all measurably degraded. But this is the unsettling part: when the researchers asked these subjects how sleepy they felt, they said they were fine and that they maybe felt a little tired. Their subjective sense of impairment flatlined, and they stopped noticing they were getting worse. Yet the objective tests kept declining, day after day. That’s the real trap. When you’re sleep deprived, your brain loses the ability to accurately assess its own performance. You feel okay, but you’re really not. A lot of people would argue that they are fully functional on 6 or less hours of sleep. Realistically, however, a very small percentage of people, roughly 1 to 3 percent, are genuinely genetically wired to function on less sleep [5]. For the rest of us who believe we’re fine on 6 hours, the research says you’re not, and the reason you think you’re fine is literally part of the impairment. Your brain has lost the ability to assess its own degraded performance, and that’s what makes this so dangerous.

Let me break down what other effects sleep deprivation can have on the brain:

Memory: Remember the RAM to SSD analogy from earlier? When you don’t get enough sleep, the nightly save operation doesn’t finish, and the memory buffer stays full. Walker’s own lab did an fMRI study and found that sleep deprived subjects had roughly a 40% reduction in hippocampal activity when trying to form new memories compared to well rested subjects [6]. Forty percent less capacity to learn new things is a lot. Think about what that means for your life. All of the important things you learned today are sitting in temporary storage waiting to be saved. If you don’t sleep, the save doesn’t complete, and tomorrow you’re relearning what you should already know.

Decisions and focus: The prefrontal cortex is the part of your brain responsible for rational thinking, planning, weighing tradeoffs. And it is disproportionately sensitive to sleep loss. This is why sleep deprived people make impulsive decisions, struggle to hold multiple options in their head, and default to the first solution that comes to mind. That means reaching for the quick fix instead of stepping back and thinking through the right approach. It’s not because you’re lazy, but because your prefrontal cortex literally cannot maintain the cognitive load of comparing the alternatives.

Emotions: Your brain has a region called the amygdala that functions as your emotional alarm system for things like fear, anger, and threat detection. Sleep deprivation makes the amygdala dramatically overreactive. Walker’s research showed about a 60% increase in amygdala reactivity in sleep deprived subjects compared to well rested controls [7]. Normally, the prefrontal cortex acts as a brake on the amygdala. It regulates your emotional responses and keeps things proportional. But when the prefrontal cortex is degraded from sleep loss, the emotional regulation is gone. Small frustrations become outsized reactions. If you’ve ever felt short tempered on a bad night’s sleep, this is why. There’s also a study showing that when you are sleep deprived, you misread other people’s neutral facial expressions as threatening or hostile [8]. The person across the table from you may have a neutral face, but your sleep deprived brain is reading hostility into it. The world literally looks more adversarial to you when you’re underslept.

Long term risk: Your brain has its own waste clearance system called the glymphatic system. During sleep, your brain opens up channels for fluid to flow through and flush out metabolic waste. One of the things it clears is a protein called amyloid beta, which is associated with Alzheimer’s disease. For underslept individuals, this clearance is dramatically reduced. The honest framing is that poor sleep appears to be a risk factor for amyloid accumulation and Alzheimer’s disease [9]. The full causal chain isn’t established yet, but the correlation is concerning. One of the largest studies on this, the Whitehall II study, tracked about 8,000 people over 25 years starting from age 50 [10]. Those who consistently slept 6 hours or less in their 50s and 60s had roughly a 30% increased risk of developing dementia compared to those sleeping 7 hours. It’s worth knowing that every night you sleep well, your brain is running a cleaning cycle that clears out proteins linked to neurodegenerative disease.

What Sleep Deprivation Does to the Body

Sleep is doing critical maintenance work on the rest of your body too including your immune system, your heart, and your metabolism.

Immune system: After a single night of only 4 hours of sleep, your natural killer cell activity, one of the key frontline defenses of your immune system, drops by roughly 70% [11]. There’s a study out of Carnegie Mellon where researchers took a group of people, measured their sleep habits, and then literally sprayed a rhinovirus (the common cold) into their noses [12]. The people sleeping 6 hours or less were 4.2 times more likely to get sick than those sleeping 7 or more hours. And here’s one that’s more practical: if you get your flu shot after a bad night of sleep, your body produces significantly fewer antibodies in response. Your immune system can’t mount a proper response when it’s underslept. So if you’re getting vaccinated, it actually matters whether you slept well the night before.

Heart: When you sleep, your cardiovascular system gets a nightly reset. Heart rate drops, blood pressure drops, the sympathetic nervous system dials down. Your heart and blood vessels get a break. When you chronically cut sleep short, that recovery window shrinks. Your blood pressure stays elevated, inflammatory markers go up, and your cardiovascular system runs in a low grade state of stress. And there’s a natural experiment that shows just how sensitive the heart is to even small changes in sleep. Every year, twice a year, the clocks change for daylight saving time. In the spring, when we lose one hour of sleep, heart attack rates spike measurably. A study in the New England Journal of Medicine found roughly a 24% jump in heart attacks on the Monday after the spring change, with elevated rates for several days [13]. In the fall, when we gain an hour, rates drop. One hour is all it takes to move the needle at a population level. And it’s not just heart attacks. Chronic short sleep is also linked to hypertension, stroke, atrial fibrillation, and overall cardiovascular mortality.

Weight and metabolism: Sleep deprivation messes with two hormones that control hunger [14]. Ghrelin, the hormone that tells you “I’m hungry,” goes up. Leptin, the hormone that tells you “I’m full,” goes down. So you’re hungrier and you feel less satisfied when you eat. If you’ve ever had a terrible night of sleep and then couldn’t stop snacking the next day, that wasn’t a character flaw. That was your hormones doing exactly what sleep deprivation told them to do. You might think, well, at least I’m burning more calories by being awake longer. Technically true, but barely. Studies show being awake longer increases energy expenditure by about 5%. The increase in food intake blows right past that. You consume far more than the extra calories you burn. On top of that, sleep restriction impairs your body’s ability to manage blood sugar. It reduces glucose metabolism and insulin sensitivity, making chronic sleep deprivation a genuine risk factor for Type 2 diabetes.

Athletic performance: There was a study at Stanford where researchers asked basketball players to extend their sleep to 10 hours per night for several weeks [15]. Sprint times improved. Shooting percentage went up by about 9%. Reaction times got faster. For those of us who aren’t professional athletes, the same biology applies. If you exercise, a lot of your gains happen during sleep, not during the workout.

REM and Dreams

Why do we dream? It’s one of those questions humans have been asking for thousands of years. The most famous answer came from Sigmund Freud. Freud believed dreams were repressed wishes: desires your conscious mind wouldn’t allow, leaking out in symbolic form while you slept. Freud was right about a lot of things. However, his theory on repressed wishes has not withstood the test of time. There was never any strong empirical evidence for it. What it did do was create a very profitable industry of dream interpretation, people paying other people to decode the hidden meaning of their dreams, which persists to this day even though the scientific foundation has never really been there.

After Freud, the pendulum swung a different way. A lot of researchers started treating dreams as essentially meaningless, like a vestigial organ. The idea was that during REM sleep, your brainstem fires off random electrical signals, and your cortex takes that noise and stitches it into a narrative after the fact. Under this theory, dreams aren’t messages or insights, but instead they are just your brain’s pattern recognition machinery running on junk input. That view held for a while, and it made intuitive sense. Dreams are often bizarre and nonsensical, which fits the “random noise” explanation. But as researchers started using modern imaging technology to study REM more carefully, they found that this theory wasn’t right either. Modern sleep science has a new and well supported theory now. Your brain during REM is nearly as active as when you’re awake, but your body is paralyzed. And it turns out REM is doing two things that are truly remarkable:

The first is emotional processing: During REM, your brain replays emotional memories. Particularly the difficult or unresolved ones from the day like the stressful conversation, the frustrating meeting, or the things that most upset you. Your brain is replaying those experiences while you dream. The main neurochemical of stress and anxiety in the brain is called noradrenaline. REM is the only time in the entire day, wake or sleep, when your brain’s levels of noradrenaline are completely shut off. No other sleep stage does this, and being awake certainly doesn’t do this either. So when you dream, your brain is actively replaying stressful, emotionally charged memories, but in a neurochemical environment that is calm; there’s no stress chemical present. The theory is that this is how the brain processes emotional experiences. It replays the memory during a dream, retains the content, the facts, the lesson, but gradually strips away the raw emotional charge. The grief, the fear, the frustration become softer over time. To go back to our analogy from earlier, your brain loads an emotionally charged memory from long term memory flash (cortex) back into short term memory RAM (hippocampus). Then while the memory is in RAM, your brain turns off the stress settings. The noradrenaline stress chemical is gone, so the memory is present but the emotional intensity isn’t. Then it replays the memory in this calm stress free state. And then it saves the memory back to long term flash storage. The memory has the same content, same facts, and same lesson, but with a little less of the emotional charge attached. Then the next night, it does it again. And the next night. Each night of REM is another pass through that cycle, and each pass strips a little more of the sting away. Walker has a phrase for this that I think is really elegant. “We remember the lesson, but we lose the sting” [16]. This is what “time heals all wounds” actually means biologically. It’s not necessarily time but rather the REM sleep within that time. If you’ve seen the Pixar movie Inside Out, this is basically what the movie was depicting in the scenes where Riley’s day gets played back at night and her memories shift colors and get filed away in long-term storage. The science behind that part of the movie holds up remarkably well: emotional memories really do get replayed at night, and the emotional charge attached to them really does change.

The second thing REM does is creative problem solving: During REM, your brain deliberately relaxes its normal rules of association. It makes connections between distantly related memories and ideas that your waking brain would never make because they don’t follow logical rules. That’s why dreams are bizarre. Your brain isn’t malfunctioning, it’s exploring and testing unlikely combinations. This has real implications for the kind of work we do. If you’ve ever been stuck on a problem for hours, gone home, slept on it, and had the answer come easily the next morning, that’s not a coincidence. That’s REM doing exactly what the research predicts. REM is finding connections your focused, deliberate, waking brain couldn’t. The phrase “sleep on it” isn’t just folk wisdom, it’s literally good engineering advice. A research group in Germany ran a classic study where subjects were trained on a math problem that had a hidden shortcut, then either got 8 hours of sleep or stayed awake for 8 hours before being tested [17]. The sleep group was monitored with EEG so the researchers knew they actually slept, not lying in bed thinking about the problem. Same task, same training, same elapsed time, just one group slept and the other didn’t. The sleep group was more than twice as likely to discover the shortcut. Sleep found the pattern that conscious effort missed.

Remember that REM lives disproportionately in the last two hours of sleep. When you cut an 8 hour night down to 6, you’re not losing a little REM evenly. Instead, you’re losing most of it. And that means you’re losing your brain’s nightly therapy session. You’re losing creative connections and you’re arriving the next day with yesterday’s emotional baggage still unprocessed. And if you’re going through a difficult time in your life, this is when REM matters most. That’s exactly when your brain has the most emotional processing to do. Cutting sleep short during those periods is the worst time to do it, even though stress is often the thing keeping you up. If there’s one takeaway from this section, it’s that protecting your sleep during hard times isn’t self indulgent. It’s how your brain heals.

What You Can Actually Do About It

Here are some tips for how to improve your sleep based on the National Institutes of Health’s official sleep recommendations:

Stick to a sleep schedule: This one’s less exciting but it might be the single most important habit. Your circadian rhythm loves regularity. Having the same wake time every day, including weekends, is more impactful than having the same bedtime. Your circadian clock anchors to your morning wake signal. When you keep it stable, the whole system stays aligned. One related concept is chronotypes: whether you’re naturally a morning person or a night owl is largely genetic. If you’re a night owl, and a lot of people in tech are, that’s real biology, not a character flaw. A night owl forced into a 7am alarm is fighting their own circadian wiring every day. If you have any flexibility in your schedule, use it.

Exercise, but not too late in the day: 30 minutes or more most days is great. The main reason to do exercise earlier in the day is that intense exercise raises your core body temperature for several hours, and your body needs to drop its core temperature for sleep to start. If you work out 4 or more hours before bed, the compensatory cooling afterward actually helps sleep. But vigorous exercise too close to bedtime delays sleep onset.

Caffeine: We already covered this in detail, so I’ll keep it short. Caffeine blocks adenosine (the sleep pressure neurochemical), it has a 5 to 7 hour half life, and a 2pm coffee is still 25% active at 2am. Try to set a caffeine cutoff. Noon to 2pm is ideal, and if you need the coffee ritual in the afternoon, maybe switch to decaf.

Alcohol: This is one that a lot of people get wrong. Alcohol feels like it helps you sleep, but what alcohol actually does is sedate you. Sedation is not sleep. Your brain under alcohol doesn’t produce the same brainwave patterns as natural sleep (as shown in EEG tests). You lose deep sleep quality and you significantly suppress REM. And in the second half of the night, as your body metabolizes the alcohol, you wake up repeatedly. Brief arousals that break up your sleep cycles, even if you don’t remember them in the morning.

Food and drink timing: Don’t eat a large meal right before bed as it will interfere with sleep. A light snack is fine, but a full dinner or excessive fluid intake at 10pm is working against you.

Medications: Some commonly prescribed heart, blood pressure, and asthma medications, plus some over-the-counter cold or allergy remedies, can disrupt sleep. If you’re having sleep trouble and you take any of these, it’s worth asking your doctor or pharmacist whether the timing of doses or the medication itself can be adjusted.

Naps: Naps can genuinely help if you’re running a deficit. But keep them before 3pm. A late afternoon nap can burn off enough adenosine (sleep pressure) that your brain may not be ready to sleep at bedtime. Keep adult naps under 20 minutes if you can.

Take a hot shower or bath before bed: This sounds counterintuitive but it works [18]. Your body needs to drop its core temperature by about one degree Celsius to fall asleep. A hot shower or bath 1 to 2 hours before bed actually helps you cool down faster. The hot water causes blood vessels near your skin to dilate, bringing more blood to the surface of your skin. Your body dumps core heat through the skin much faster than it would otherwise, and your core temperature drops faster than if you hadn’t showered at all. Wearing socks to bed uses the same mechanism. There was a study in Nature that found warm hands and feet were one of the strongest predictors of how quickly someone fell asleep [19]. Your hands and feet are two of the body’s primary heat radiators. They have specialized blood vessels that can open wide to dump heat from your core. So warm socks actually help you cool down. It’s one of the simplest (and most counterintuitive) sleep interventions that exists.

Have a good sleeping environment: Keep your room cool, dark, and quiet. Cool means around 65 to 68 degrees Fahrenheit, which is cooler than most people keep their bedrooms. Dark means really dark. Even a small charging LED on a laptop or phone is enough to interfere with melatonin (the “it’s nighttime now” hormone). Light is the primary signal that synchronizes your circadian clock. To be specific, there are cells in your eyes that are most sensitive to blue wavelengths of light, around 460 to 480 nanometers. When those cells get triggered, they tell your master clock “it’s daytime,” and your brain suppresses melatonin [20]. The reason LED bulbs and screens are the problem here is that they emit a lot of light in that blue range. Old incandescent bulbs emitted mostly warm, amber light with very little blue, so they barely triggered this response. Modern LEDs and screens emit much more blue, which is why having your normal lights on at 10pm is essentially telling your brain “still daytime, stay alert.” The fix is to dim your lights in the hour before bed and try to avoid screens. If that’s not realistic, switch your phone and laptop to night mode (Apple’s Night Shift, Android’s Night Light, or similar), which filters the blue wavelengths out of your display and shifts it toward warm tones. Set it on an automatic sunset schedule so it just happens without you thinking about it.

Morning sunlight: Light at night is bad, but light in the morning is one of the highest yield things you can do for your sleep. Morning sunlight is what tells your brain that daytime has started and anchors the timing of melatonin release that night. Try to get 20-30 minutes of natural light early in the day. If you have trouble falling asleep at night, this is one of the first things sleep experts recommend.

If you can’t sleep, get up: This one feels wrong, but it’s one of the most well supported techniques in sleep medicine. If you’ve been lying in bed for 20 or 30 minutes and you can’t fall asleep, don’t stay there. Get up, go to a different room, and do something quiet and boring in dim light. And only go back to bed when you actually feel sleepy. The reason is that lying awake in bed trains your brain to associate bed with wakefulness and frustration. Over time, your bed becomes a trigger for anxiety instead of sleep. Getting up breaks that association. This is a core principle of something called CBT-I, Cognitive Behavioral Therapy for Insomnia, which is actually recommended as the first line treatment for chronic insomnia, ahead of sleeping pills [21].

A quick word on melatonin and sleep pills: Melatonin is widely misunderstood. It does have a real but mild effect on falling asleep faster, but it is not a sedative. Its main job is telling your body “it’s nighttime now” by shifting the timing of your circadian curve. Figure 5 makes this concrete. The wake drive curve moves earlier when you take melatonin in the evening (or later when you take it in the morning), but it does not change sleep pressure at all. That’s why melatonin is most useful when you actually need to move your sleep window, like jet lag or working an occasional night shift, not as an everyday sleep aid. As for sleeping pills, they often produce something that looks like sleep. When using sleeping pills, you’re unconscious and your brainwaves slow down. But the brain often doesn’t have the same degree of memory consolidation and emotional processing it would in natural sleep (as shown in the EEG). I’m not a doctor, but it’s worth knowing that “I took a pill and I was out” doesn’t necessarily mean your brain got what it needed.

Figure 5: What melatonin actually does. It shifts the circadian wake drive earlier or later (depending on when you take it), which is why it helps for jet lag and shifting your sleep window. It does not change sleep pressure.

One more thing people always wonder. Can you catch up on weekends? The honest answer is partially, but not fully. You can recover some alertness with extra sleep on Saturday. But the deep sleep and REM you missed on Tuesday night are gone. Your brain doesn’t go back and retroactively consolidate those memories or process those emotions. There’s also a concept called social jet lag. When your weekend sleep schedule drifts significantly from your weekday schedule, you’re essentially giving yourself jet lag every Monday morning [22]. If you sleep until noon on Sunday and wake up at 6:30 Monday, that’s a 5 and a half hour timezone shift your circadian rhythm has to absorb. Consistency beats bingeing, and a steady 7 to 8 hours every night does more for you than 6 hours during the week and 10 on weekends.

Closing

I know that not everyone has the luxury of optimizing their sleep. If you’re a new parent, or a caregiver, or dealing with a medical condition, or just going through a season of life where sleep is hard to come by, you already know sleep matters. This post isn’t about guilt but rather about understanding what’s happening so you can make the best choices within whatever constraints you have. Sometimes just knowing why you feel the way you do on a rough night can help you be a little kinder to yourself about it.

When I first started working at SEP, I would come home after work and feel absolutely exhausted. There was so much to learn. An entire company culture, new people, team dynamics, customer relations, tech stacks, and more. I just wanted to be able to maintain my productivity at work, and still be able to have energy by the time I came home. So like anyone else these days, I asked ChatGPT what the best things I could do to be more efficient while maintaining my productivity level at work. ChatGPT gave me a whole list of things to do. But at the end of the list, it said that if you are going to do just one thing on this list, by far the most important is prioritizing getting a consistent 8 hours of sleep every night. And I could not agree more.

If any of this was interesting to you, the book that gave me the idea for this post is called Why We Sleep by Matthew Walker. It goes much deeper than I could here, and it genuinely changed how I think about sleep and how it impacts our lives.

Thanks for reading! If you want to talk about any of this, reach out! I’m always happy to chat

Evan Parshall

[email protected]

Appendix: 12 Tips for Better Sleep

For a printable one-page summary of the practical tips, I put together a handout adapted from the NIH’s Your Guide to Healthy Sleep with the mechanism notes from this post folded in.

References

[1] Siffre, M. (1964). Beyond Time (English translation). McGraw-Hill. See also: Siffre, M. (1975). “Six Months Alone in a Cave.” National Geographic, 147(3), 426-435.

[2] Institute of Medicine (U.S.) Committee on Military Nutrition Research. (2001). Caffeine for the Sustainment of Mental Task Performance: Formulations for Military Operations. Washington, DC: National Academies Press. (Caffeine half-life typically 3-7 hours, average roughly 5-6 hours.)

[3] Kemp, B., Zwinderman, A. H., Tuk, B., Kamphuisen, H. A. C., & Oberyé, J. J. L. (2000). “Analysis of a sleep-dependent neuronal feedback loop: the slow-wave microcontinuity of the EEG.” IEEE Transactions on Biomedical Engineering, 47(9), 1185-1194. Dataset accessed via PhysioNet (Goldberger, A. L., et al. (2000). “PhysioBank, PhysioToolkit, and PhysioNet.” Circulation, 101(23), e215-e220). Sleep-EDF Database Expanded, https://physionet.org/content/sleep-edfx/1.0.0/. Licensed under ODC-BY 1.0.

[4] Van Dongen, H. P. A., Maislin, G., Mullington, J. M., & Dinges, D. F. (2003). “The cumulative cost of additional wakefulness: Dose-response effects on neurobehavioral functions and sleep physiology from chronic sleep restriction and total sleep deprivation.” Sleep, 26(2), 117-126.

[5] He, Y., Jones, C. R., Fujiki, N., et al. (2009). “The transcriptional repressor DEC2 regulates sleep length in mammals.” Science, 325(5942), 866-870. See also: Pellegrino, R., et al. (2014). “A novel BHLHE41 variant is associated with short sleep and resistance to sleep deprivation in humans.” Sleep, 37(8), 1327-1336.

[6] Yoo, S. S., Hu, P. T., Gujar, N., Jolesz, F. A., & Walker, M. P. (2007). “A deficit in the ability to form new human memories without sleep.” Nature Neuroscience, 10(3), 385-392.

[7] Yoo, S. S., Gujar, N., Hu, P., Jolesz, F. A., & Walker, M. P. (2007). “The human emotional brain without sleep: a prefrontal amygdala disconnect.” Current Biology, 17(20), R877-R878.

[8] Goldstein-Piekarski, A. N., Greer, S. M., Saletin, J. M., & Walker, M. P. (2015). “Sleep deprivation impairs the human central and peripheral nervous system discrimination of social threat.” Journal of Neuroscience, 35(28), 10135-10145.

[9] Xie, L., Kang, H., Xu, Q., et al. (2013). “Sleep drives metabolite clearance from the adult brain.” Science, 342(6156), 373-377.

[10] Sabia, S., Fayosse, A., Dumurgier, J., et al. (2021). “Association of sleep duration in middle and old age with incidence of dementia.” Nature Communications, 12, 2289.

[11] Irwin, M., Mascovich, A., Gillin, J. C., et al. (1994). “Partial sleep deprivation reduces natural killer cell activity in humans.” Psychosomatic Medicine, 56(6), 493-498.

[12] Prather, A. A., Janicki-Deverts, D., Hall, M. H., & Cohen, S. (2015). “Behaviorally assessed sleep and susceptibility to the common cold.” Sleep, 38(9), 1353-1359.

[13] Janszky, I., & Ljung, R. (2008). “Shifts to and from daylight saving time and incidence of myocardial infarction.” New England Journal of Medicine, 359(18), 1966-1968.

[14] Spiegel, K., Tasali, E., Penev, P., & Van Cauter, E. (2004). “Brief communication: Sleep curtailment in healthy young men is associated with decreased leptin levels, elevated ghrelin levels, and increased hunger and appetite.” Annals of Internal Medicine, 141(11), 846-850.

[15] Mah, C. D., Mah, K. E., Kezirian, E. J., & Dement, W. C. (2011). “The effects of sleep extension on the athletic performance of collegiate basketball players.” Sleep, 34(7), 943-950.

[16] Walker, M. (2017). Why We Sleep: Unlocking the Power of Sleep and Dreams. Scribner.

[17] Wagner, U., Gais, S., Haider, H., Verleger, R., & Born, J. (2004). “Sleep inspires insight.” Nature, 427(6972), 352-355.

[18] Haghayegh, S., Khoshnevis, S., Smolensky, M. H., Diller, K. R., & Castriotta, R. J. (2019). “Before-bedtime passive body heating by warm shower or bath to improve sleep: A systematic review and meta-analysis.” Sleep Medicine Reviews, 46, 124-135.

[19] Kräuchi, K., Cajochen, C., Werth, E., & Wirz-Justice, A. (1999). “Warm feet promote the rapid onset of sleep.” Nature, 401(6748), 36-37.

[20] Chang, A. M., Aeschbach, D., Duffy, J. F., & Czeisler, C. A. (2015). “Evening use of light-emitting eReaders negatively affects sleep, circadian timing, and next-morning alertness.” Proceedings of the National Academy of Sciences, 112(4), 1232-1237.

[21] Qaseem, A., Kansagara, D., Forciea, M. A., et al. (2016). “Management of chronic insomnia disorder in adults: A clinical practice guideline from the American College of Physicians.” Annals of Internal Medicine, 165(2), 125-133. See also: Trauer, J. M., Qian, M. Y., Doyle, J. S., Rajaratnam, S. M. W., & Cunnington, D. (2015). “Cognitive behavioral therapy for chronic insomnia: A systematic review and meta-analysis.” Annals of Internal Medicine, 163(3), 191-204.

[22] Wittmann, M., Dinich, J., Merrow, M., & Roenneberg, T. (2006). “Social jetlag: Misalignment of biological and social time.” Chronobiology International, 23(1-2), 497-509.

Updated:

Published: