DEV Community

Dan Dascalescu
Dan Dascalescu

Posted on • Updated on

The best sleep hygiene guidelines

Sleep is key for cognitive performance, which is key for being a successful software developer. Over the past 15 years, I've been consuming a lot of materials regarding sleep optimization, I've used some of the best consumer-grade sleep trackers (QS Emfit, Oura), and put together a summary of the best practices I have for optimizing sleep. 💤 Here we go: 🚀

Sleep Environment

  1. No partner or pets in bed, or if a partner is a must, use an extra large bed and separate quilts.
  2. Quiet bedroom; earplugs are great at reducing ambient noise. Some people prefer white noise machines.
  3. Cool bedroom. The optimal sleep temperature is around 65F.
  4. Dark bedroom. Blackout curtains work very well.
  5. Dim lights in the evening.
  6. This is less important than dimming lights, and more controversial, but see if it helps: reduce blue light exposure past sunset. Use apps/settings like "Night mode", or wear blue light blocking glasses.
  7. Invest in a quality mattress, and sleep on the same bed, slightly harder than what you'd intuitively select. My favorites nowadays are the Helix mattress (tested) and Purple (not tested, but felt even better than Helix in store).

Timing

  1. Consistent time to go to sleep AND wake up. Even on weekends. (Details on the circadian rhythm from Menno Henselmans and Andrew Huberman)
  2. If you're trying to shift your schedule earlier (which may improve mental health and performance), do so in at most 30-minute increments (unless you're dead-tired). I've found myself many time trying to go to bed an hour or more earlier, only to be unable to fall asleep. Melatonin may (Gwern) or may now (Huberman) help or be indicated.
  3. Bright light exposure as soon as possible after waking up, e.g. have breakfast by the window, walk outside. Note that Huberman cites research showing that glass reduces the effectiveness of light on circadian rhythm regulation by 50x (!). That means you'd need 10 minutes outside, or 500 minutes (a full workday) by the window to achieve the same benefits.
  4. No snoozing. When it's time to wake up, wake up.
  5. Avoid exercising 4 hours before sleep. [With the exception of sex]
  6. Avoid stimulation before sleep, such as reading news, or having stressful interactions. Best to read a physical book (or an electronic one in dark mode) until you notice you slightly lose focus. Slightly boring books help.
  7. Showering/bath 1-2 hours before sleep may help.

Food/supplements

  1. Avoid caffeine 8 hours before sleep, or longer if you're particularly sensitive to it.
  2. Avoid alcohol before sleep. It may help with falling asleep, but reduces sleep quality.
  3. Ideally, avoid heavy meals several hours before sleep.
  4. Carbs may help with sleep, so target them for dinner.
  5. Experiment with melatonin, from 0.1 to 10g. Sensitivity is highly individual.
  6. Avoid sleeping pills. They may help fall asleep faster, but the expense of quality.

Further resources

Top comments (0)