The best sleep hygiene guidelines
Published: 2021-09-22 14:30:48

---
title: The best sleep hygiene guidelines
published: true
description: 
tags: 
//cover_image: https://direct_url_to_image.jpg
---
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](https://drive.google.com/file/d/1gKsDmxyoZZxGmz_zaC_mQgjCAShxg75H/view) and [Andrew Huberman](https://dev.to/dandv/better-sleep-for-programmers-according-to-andrew-huberman-4ajd))
2. If you're trying to shift your schedule earlier (which may [improve mental health and performance](https://youtu.be/qAIT2nmqYd4?t=234)), 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](https://www.gwern.net/Melatonin)) 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](https://news.utexas.edu/2019/07/19/take-a-warm-bath-1-2-hours-before-bedtime-to-get-better-sleep-researchers-find/) 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

- My summary of an [excellent talk at Google](https://pinboard.in/u:dandv/b:a98ad9f26b4f)
- [Art of Manliness on sleep](https://www.artofmanliness.com/articles/how-to-get-a-good-nights-sleep/) (note that intermittent fasting may or may not work, by increasing cortisol)
- [Why 6 hours of sleep/night is surprisingly bad](https://www.fastcompany.com/3057465/why-six-hours-of-sleep-is-as-bad-as-none-at-all)