How I took back control of my sleep to code better, recover faster from training, and learn more effectively. The science, the 3 changes I actually made, and my honest experience.

For a long time, I treated sleep as the adjustable variable. A big coding session to finish? I borrowed from the night. Tempted by one more episode? The night paid the bill. I told myself it was fine, that I would catch up on the weekend, that I was holding up anyway.
Except I was not holding up that well. By midweek, my strength sessions felt flat. In front of my editor, I would reread the same function three times without understanding it. And my evening Korean sessions? I might as well have been talking to a wall, nothing stuck. That was the wake-up call: it was not a lack of motivation or discipline, it was fatigue. A deep, settled tiredness I had stopped even noticing.
The ironic part is that I started with an advantage: I consume no caffeine at all. No coffee, no strong tea, no energy drinks. In theory, I should have slept like a baby. And yet I did not. Because caffeine is only one piece of the puzzle, and I was sabotaging all the others without realizing it.
So I did what I always do when a topic nags at me: I read. Not Reddit threads this time (the creatine lesson stuck), but the actual studies. And what I found convinced me to change three concrete things. Here is what they are, why, and what changed for me.
We talk a lot about optimization: a better training program, a better tech stack, a better learning method. But we forget the foundation everything rests on. Sleep is not dead time when the body pauses. It is an active, highly organized process: memory consolidation, muscle repair, hormonal regulation, clearing the brain's metabolic waste. Cutting sleep short means sabotaging all of that background work.
The trap is that you do not really feel the deficit. That is probably the most striking result from the study by Van Dongen et al. (2003), published in Sleep: participants restricted to 6 hours of sleep per night for two weeks saw their cognitive performance fall to the level of people who had pulled two consecutive all-nighters. The worst part? They barely perceived their own decline. They felt roughly normal while being objectively impaired.
That was exactly my situation. I did not feel exhausted, I felt "okay." But my "okay" was running well below my real baseline.
The key takeaway
Chronic sleep loss does not feel like obvious fatigue. You get used to a degraded version of yourself without noticing. That is precisely what makes it dangerous for performance, whether physical or intellectual.
Before changing anything, I wanted to understand the real impact of sleep on the four areas that matter to me: sport, code, memory, and mood. Here is what the literature shows.
The most compelling study is still the one by Mah et al. (2011), published in Sleep. Stanford college basketball players extended their sleep to around 10 hours per night for several weeks. The result: faster sprints, improved shooting accuracy (free throws and three-pointers), shorter reaction times, and better mood. Not thanks to a new training program, just from sleeping more.
On the hormonal side, it is even sharper. Leproult and Van Cauter (2011), in JAMA, showed that a single week of restriction to 5 hours of sleep is enough to drop testosterone by 10 to 15% in healthy young men. Testosterone is a key driver of recovery and muscle building. In other words: you can take the best creatine in the world, but if you sleep poorly, you are braking your own gains.
Development is pure cognitive load: holding a complex mental model in your head, juggling several files, anticipating side effects. And that is exactly what sleep loss destroys first. The Van Dongen study cited above measures it plainly: sustained attention, processing speed, and working memory all collapse with sleep debt.
In practice, a poor night means more bugs introduced, more time spent rereading the same logic, and that foggy feeling where nothing moves forward. I came to understand that my least productive coding days were not a methodology problem: they started the night before.
This is the point that resonated most with me as a Korean learner. The landmark review by Rasch and Born (2013), published in Physiological Reviews ("About Sleep's Role in Memory"), explains the central role of sleep in memory consolidation. It is during the night that the brain transfers what you learned during the day into long-term memory and reinforces new skills.
Reviewing Korean vocabulary flashcards right before bed, then sacrificing the night, means sabotaging the exact moment the work gets imprinted. Conversely, sleeping well after a study session lets the brain finish the job for you.
Sleep affects more than "measurable" performance, it shapes your mental state. The study by Yoo et al. (2007) showed that after sleep deprivation, the amygdala (the center of emotional reactions) becomes markedly more reactive, while the prefrontal cortex that regulates it disengages. Translation: less sleep, more irritability, less perspective, emotions on a roller coaster.
This connects with what I covered in my article on dopamine and social media: a tired brain resists far less well against stimulation, compulsive scrolling, and impulsive decisions. Sleep is the first line of defense for willpower.
The benefits of good sleep in short
Sleeping better means sprinting faster and recovering better from training, coding with fewer errors, retaining what you learn, and staying mentally stable. No supplement and no productivity app offers a comparable return on investment.
Theory is nice, but I wanted concrete actions. I identified three levers and applied them. Nothing revolutionary, nothing that costs money, just consistency.
This is by far the hardest change, and the most effective. Before, I would code or scroll until lights out, phone in hand, screen at full brightness. A bad idea on every level.
The study by Chang et al. (2015), published in PNAS, is unequivocal: reading on a light-emitting device in the evening suppresses melatonin secretion (the sleep hormone), delays the biological clock, lengthens the time it takes to fall asleep, and degrades alertness the next morning. Light, especially in blue wavelengths, literally tells your brain it is still daytime.
What I did instead:
The one change that matters most
If there is a single thing to take from this article, it is this: replace the evening phone with a paper book. It is not only about blue light, it is also a decompression buffer that prepares the brain for sleep instead of overstimulating it.
We underestimate how much the environment drives sleep quality. I treated my bedroom as what it should be: a place dedicated to rest, not a second office.
I do not touch caffeine (I do not consume any), but food plays a role through another channel: the timing and heaviness of the evening meal. A dinner that is too late or too large forces digestion to run while the body is trying to slow down, which fragments sleep and delays falling asleep.
So I moved my dinner earlier and keep it lighter, avoiding very fatty or sugary meals right before bed. Nothing drastic, but giving the body time to digest before lying down makes a real difference to sleep quality.
And what about caffeine?
I do not consume any, so it was not a lever for me, but it is worth the reminder. The study by Drake et al. (2013), in the Journal of Clinical Sleep Medicine, showed that caffeine taken even 6 hours before bed cuts sleep time by more than an hour. If you drink coffee in the afternoon and sleep poorly, you may have found your first suspect.
I will be honest like with creatine: it is not magic overnight, but the cumulative effect is real and it sets in fast.
The first few days, the hardest part was letting go of the phone in the evening. My hand kept reaching for it out of reflex. But once the book was open, sleep came noticeably faster. No more forty-five minutes staring at the ceiling after putting the screen down.
After one to two weeks, the clearest change was focus. My coding mornings became sharper: I hold a complex problem in my head longer, I make fewer pointless round trips, and that foggy feeling has largely receded. I code fewer hours some days, but I get more done.
At training, I felt better recovery between sessions. The midweek fatigue, when I stack strength training, swimming, and running, is far more manageable. My end-of-week sessions are no longer fights against exhaustion.
For Korean, it is subtler but clearly there: reviewing in the evening, then sleeping properly, and noticing the next day that the vocabulary is better anchored, is exactly what the science predicts. Consistent sleep makes consistent learning pay off.
On mood, finally, I am calmer. Less irritability over small surprises, more perspective, and much less urge to scroll into the void. A rested brain is a brain that decides instead of reacting.
My personal advice
Do not try to change everything at once. Start with one thing: take the phone out of your bedroom tonight. It is free, it is immediate, and it is probably the best effort-to-result lever on this whole list.
If I had to sum it up: sleep is the most powerful and most neglected performance lever there is. It costs nothing, it has no side effects, and it improves the body, the brain, memory, and mood all at once. No supplement and no productivity method can claim that.
What struck me was realizing how much I was sabotaging my own sleep while thinking I was saving time. The hours scraped together in the evening in front of a screen cost me far more the next day in focus, energy, and patience. Sleep is not lost time, it is the investment that makes everything else pay off.
I do nothing extraordinary: no screens in the evening, a dark and cool bedroom with no phone, a lighter and earlier dinner. Three simple changes, held consistently. And as with creatine, the real secret is not intensity, it is consistency.
Run your own experiments, observe what works for you, and stop sacrificing your nights in the belief that you are winning your days.
Raphaël Raclot is a French full stack developer passionate about cybersecurity and modern web technologies. He specializes in React, Next.js, and TypeScript, and shares his discoveries, projects, and insights here.
Learn more about Raphaël
Introducing Capybook, a free web app for tracking your reading life that I built with Next.js. From concept to launch, the story of a side project born from a reader's frustration.

Everything you need to know about creatine monohydrate: scientific studies, debunked myths, dosage, and my personal experience after 2 months of supplementation.

Discover how apps and social media exploit your dopaminergic system, and concrete strategies to take back control.