Prabal Tripathi

Sleep Is a Feature

I tracked the correlation between sleep and the quality of my work, and the result was annoying.

I spent a few months loosely noting two things: hours slept, and whether the next day's work was good.

"Good" is unscientific. I used a rough test — did I ship something I'd still defend a week later, or did I mostly thrash.

The correlation was embarrassingly strong, and not where I expected.

It wasn't about the amount

Six hours and seven hours were nearly indistinguishable. The thing that predicted a bad day was irregularity — a six-hour night after a string of eights was worse than a steady run of sixes.

Which is irritating, because the lever I'd been pulling was "try to sleep more," and the lever that mattered was "sleep at the same time."

What a bad day actually looks like

The interesting part wasn't that bad days were less productive. It's how they were worse.

On a short-sleep day I could still write code. Fingers worked, syntax fine, tests passed. What degraded was judgment:

  • I'd start the first solution I thought of instead of the third
  • I'd keep going on an approach well past the point I should have abandoned it
  • I'd read a log, miss the obvious thing, and build a theory

That last one is the five-week-pipeline failure mode in miniature. Tired me doesn't stop debugging. Tired me debugs confidently in the wrong direction, which is strictly worse than stopping.

Why it's hard to notice

Because effort feels the same. You're trying just as hard. You're at the desk the same number of hours. By every signal available from inside your own head, you're working.

The deficit is invisible from the inside, which is exactly why I had to write it down to see it.

What changed

Nothing heroic. Same bedtime, within about forty minutes, including weekends. That's it, and it's the only habit change I've made in two years that produced an effect I could actually measure.

I'd be more smug about this if it weren't advice that every single person already gives you.