Blog · Orma · · 5 min read

Does Sleep Affect Coding Productivity? My Data Says Yes

I correlated 3 months of HealthKit sleep data with my daily coding output. The results were not surprising — but the magnitude was.

Every developer has an intuition that sleep matters. But intuition is not data. I wanted to know exactly how much sleep affects my coding output, so I used xeve's correlation engine to find out.

The Setup

xeve's iOS app syncs HealthKit data including sleep duration, and the macOS app tracks coding sessions in VS Code, Terminal, and Claude Code. The correlation engine uses the Pearson correlation coefficient to find relationships between any two metrics across time.

I looked at the correlation between sleep duration (previous night) and productive coding hours (next day) over three months of data.

The Results

The correlation coefficient was 0.64 — a moderately strong positive correlation. In plain English: nights with more sleep were reliably followed by days with more productive coding.

But the interesting part was not the correlation itself — it was the threshold effect:

The jump from under 6 hours to 7+ hours was 2.5x more productive coding time. That is not a marginal improvement. That is the difference between shipping a feature and not.

Context Switching

Sleep also correlated with context-switching frequency. On well-rested days, I averaged 12 app switches per hour. On sleep-deprived days, that jumped to 23 switches per hour — nearly double. More switching means more time lost to reorientation, which compounds throughout the day.

How the Correlation Engine Works

xeve computes correlations automatically across 19 metric pairs. The engine pulls daily aggregated data from your daily summaries, computes Pearson's r, and generates a plain-English interpretation:

The engine also checks for statistical significance — correlations based on fewer data points are flagged as less reliable.

Other Interesting Correlations

Beyond sleep, a few other correlations stood out in my data:

Actionable Takeaways

The data confirmed what I suspected but gave me the conviction to change behavior:

The correlation engine runs automatically in xeve. Connect HealthKit via the iOS app, and you will start seeing your own patterns within a week. Your data will tell a different story than mine — and that is exactly the point.