Sleep, perchance to code

I take naps at work.

There. I said it. My career is probably ruined now.

In grade school I don’t remember what classes I had after lunch, but I probably came close to failing them. There is something evil — or at least unthinking — when an institution requires intellectual activity in the early afternoon. I found it utterly futile to absorb trigonometry or history in that desperate hour or two after lunch, when I was yawning and trying valiantly to stay awake. In college I scheduled nothing important from noon until 2. In public school you don’t always have a choice, and your best bet is to take a class from a teacher who is cool about your forehead hitting the desk occasionally.

Civilized societies have siestas.

In the corporate world, meetings after lunch are commonplace. We schedule meetings during lunch. Jeepers, we have lunch interviews — just try explaining how a hash table works while you’re scarfing down cafeteria food:

Candidate: “Okay, these olives represent hash functions. And these Fritos are hash buckets. Now, we probe using this carrot, following the linked chain of peas until the end of the bucket or we fall off the table.”

Me: “Fine. And deletion?”

“Well, the peas are chained, so it’s a simple single-list removal. And when the list is empty, we get to eat a chip. Uh, list header.”

“Okay, radishes are now threads. How do you handle radish-safety?”

“Oh, a lock. But I’m allergic to radishes. You could go lock-free if you knew your system’s memory model really well; I’d rather eat celery all week.”

“So Q/A is all of this mysterious green crap over here, and your management chain is, well, we can build a little fort out of the potatoes and cauliflower. Your annual review is this flabby little pickle, bonuses are the pile of toothpicks, and HR is the smear of ketchup left from the last guy’s exit interview. Now, as I spill the soda (representing layoffs) over the whole organization, who stays high and dry?”



Naturally, dessert has chocolate chip cookies representing scheduling tokens in a real-time embedded system (“Let’s kill another process … yum”), with a slowly melting ice cream cone being the hard deadline. Oh, our interviews are merciless.


The problem with naps at work is where to take them. If you have your own office with a door that locks, you’re golden. If you’re in a warren of cubes you’re pretty much out of luck unless your cow-orkers are cool with seeing your feet stick out from under your desk. In the latter situation you also run the risk that someone not in the know will come by, spot your unmoving feet and call 911.

“Operator? One of my cow-orkers is dead!”

“Cow what?”

“Never mind, come quickly!”

… and when you get up and groggily try to explain that you were just taking a quick 20 minute schnozz, you get a face-full of double-ought buckshot because “Shit! He was daid and he’s gone an’ turned into a zombie!”  Ka-pow, that sucks.


I firmly believe that twenty minutes of shut-eye, even just calming down and letting your mind peacefully wander, is conducive to an entire afternoon of creative work, and should be encouraged by modern corporations in the form of nap rooms and group quiet times.

And milk and cookies.

Author: landon

My mom thinks I'm in high tech.

22 thoughts on “Sleep, perchance to code”

  1. Heh, if you think it was hard absorbing knowledge at school after dinner, you should try teaching kids after dinner.

    Or after dinner on a Friday in a warm computer room. “Right then, today we’re going to continue this highly stimulating spreadsheet work, please stay awake, you’re sending me to sleep now”.

    Or on Monday mornings – “Spreadsheets… you know, that grid thing that is not maths”

    Come to think of it, there’s about ten minutes mid-morning on a Wednesday when they seem most active, other than that it’s an uphill struggle.


  2. I go for a walk some days.

    Actually I’m usually fine right after lunch, I get unproductive for a time somewhere between 3 and 5, so I’ll often space out then, then have a nice burst of activity from 4:30 or so to 6 or 6:30 finishing stuff off for the day.

  3. How hard is the “afterlunch” can be seen very easily if you are speaker or a team lead… Just schedule a education or team meeting for 2pm 🙂

  4. In China it is very common to sleep for 1 hour after lunch. Unfortunately I could never get into the habit of it. So when my engineers were getting all refreshed I had to wash down my noodles with some caffeine 🙁

  5. I actually run a site dedicated to this concept. If you take naps a couple of times a day you will not only be more refreshed and productive, but will require less sleep at night.

  6. A psychologist who gave a presentation on stress at the place I work said that going for a walk after lunch was a simple, quick and effective way to improve your productivity. After trying it out for a while I completely agree.

  7. One of my coworkers used to sleep in the storage room with the lights off… the receptionist went in there and he stumbled up and startled her. She thought he was a homeless man.

  8. Sleep in the bathroom stall. Only issue is sometimes your legs fall asleep from sitting there too long.

  9. I thought that in civilized countries we telecommute and use flexible hours, which also makes naps much easier.

  10. I thought George on Seinfeld had a good idea.

    Also if you can keep your head propped up in your hand you can pretend you are reading a book.

  11. There are hypotheses stating that one of the primary functions of sleep is indeed problem solving, or, from another perspective, preparation for esp. unconsciously foreseeable problems, be they real or not.

    Since many of the “safety locks” posed by consciousness are disengaged esp. in deep sleep, the unconscious, i. e. overall more primeval part of the brain, is free to design physically hazard-free proving grounds which it then aims to successfully traverse.

    That’s why the contents of nightmares (which are actually more frequent than pleasant ones, but rarely “make it through the night”) often match presumed fears, like being chased by some animal (frequent in more primeval societies, e. g. jungle tribes), or, well, more in this part of the world, having to code or to perform a difficult sonata. As said, this is prone to “fake” input, like watching a horror movie.

    Another obvious example are dogs, about everybody should have seen them “running” in their sleep, even barking. It’s the same thing.

  12. the more my staff rests, the better they preform

    naps aren’t counter productive as they are resource efficiency

  13. You know, I used to put my head down at work in the afternoons
    as my ability to focus was impaired or impossible.

    But I changed a few things in my life to get healthy recently and
    the need for a nap has disappeared for the most part.

    Get some exercise. Don’t overdo it though – if I exercise too much it can actually make me tired during the day.

    I eat a lighter lunch. If I eat a lighter lunch like a turkey sandwich instead of a large calorie laden meal (think lasagna or burger), my energy stays more constant. Sometimes I eat half of the sandwich at lunch time, half an hour or two later.

    I cut out soft drinks.

    All of this depends on getting enough sleep. If I don’t get enough sleep, a nap would be useful, just to catch up.

    This is my own data. It’s not scientifically proven or anything, it just works for me.

  14. If you find you’re sleepy after eating might want to look into whether or not you have celiac disease or a gluten sensitivity, this is a more and more common theme with people who have it…

  15. For people like me, naps are vital. I wasted so much of my life not being able to nap. I don’t remember anything I studied at university when the class fell between 3pm and 5pm. Ditto for office work – I was just useless for the last two hours of the day. It doesn’t matter so much in the more automated office work, but problem solving like programming is a waste of time in those last two hours.

    In fact, my thinking processes are at their best for the 7 hours after my afternoon nap.

    I have always done a lot of exercise and it made no difference to my napping requirements, having a light lunch and going for a walk at lunch time also didn’t help.

    People just have different sleep requirements, and this is something that many industrialised societies just don’t recognize – we’re “human resoruces” not people. Indeed there are studies that show that people who sleep late and work late are actually more productive in their waking hours than those people who arise early.

  16. In the Prime Computer days, we had this concept of the “power nap”.

    Basically, after working for the entire night and to keep going the day after, we simply took 30 minute breaks in a dark room, where we “crashed out” for half an hour of profound, uninterropted sleep.

    That made us good for another 4 or 5 hours of work. Followed by another power nap. And so on.

    My record for this sort of thing was 96 hours of continuous work.
    But then I was a LOT younger…

  17. Week ago I started swimming before work each day (7.30-8.30) and it turned out, that mid-day drowsiness was gone! It may seem non intuitive, but when I had one day break I felt sleepy again after lunch.
    Try it!

  18. I cope by having fewer work hours after lunch. Long ago I noticed the same sleepy-non-productive trend after lunch, so I started showing up for work by 6:30-7 AM to get the most out of the day. A nice quiet office, a little breakfast oatmeal, and a cup of coffee … the code practically writes itself. Couple that with a late lunch, say 1pm, and suddenly “after lunch” is merely 2 hours of “testing” (or reading the neverending web) and planning what to do the next day. Sprinkle lightly with some office gossip around the water cooler and before you know it, its past time to go home.

    Thanks for sharing. Your stories are always so entertaining.

  19. Lot to be said for a nap in the afternoon. If I tried it though, I’d get the sack. This kind of thing is not acceptable in Australia, much though I’d like it to be.

    Where I work at the moment the a/c is terrible – when its 20 degrees C outside, its 26 to 30 (degrees C) inside, and we all get very groggy and sleepy. And this is in the middle of our winter. You can imagine what summer time is like. Not good!

  20. I’ve always found that if I’m flagging, fifteen minutes on and then fifteen minutes off until I find some momentum helps. But I’m astronomically lazy, so I’m probably not the best reference.

    Something else I think is important is fresh air, offices and computer labs, even with air con are hard on you, either by being too hot and stuffy, or by drying out your throat, nose and eyes. Open windows are excellent things.

Leave a Reply

Your email address will not be published. Required fields are marked *