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
- No partner or pets in bed, or if a partner is a must, use an extra large bed and separate quilts.
- Quiet bedroom; earplugs are great at reducing ambient noise. Some people prefer white noise machines.
- Cool bedroom. The optimal sleep temperature is around 65F.
- Dark bedroom. Blackout curtains work very well.
- Dim lights in the evening.
- 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.
- 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
- Consistent time to go to sleep AND wake up. Even on weekends. (Details on the circadian rhythm from Menno Henselmans and Andrew Huberman)
- 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.
- 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.
- No snoozing. When it's time to wake up, wake up.
- Avoid exercising 4 hours before sleep. [With the exception of sex]
- 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.
- Showering/bath 1-2 hours before sleep may help.
Food/supplements
- Avoid caffeine 8 hours before sleep, or longer if you're particularly sensitive to it.
- Avoid alcohol before sleep. It may help with falling asleep, but reduces sleep quality.
- Ideally, avoid heavy meals several hours before sleep.
- Carbs may help with sleep, so target them for dinner.
- Experiment with melatonin, from 0.1 to 10g. Sensitivity is highly individual.
- Avoid sleeping pills. They may help fall asleep faster, but the expense of quality.
Further resources
- My summary of an excellent talk at Google
- Art of Manliness on sleep (note that intermittent fasting may or may not work, by increasing cortisol)
- Why 6 hours of sleep/night is surprisingly bad
Top comments (0)