The 120-Hour Workweek - Epic Coding Time-Lapse

Last week I set out to see how many hours of programming work I could do in one week on CodeCombat, our multiplayer programming game for learning how to code. I clocked in at 120.75 hours. Here's the epic time-lapse video I generated from Telepath (watch in 1440p if you can):

So what did I learn from this experiment?

Adjustable height desks are amazing.

I bought one from Ergo Depot a few days before. I must have switched between sitting and standing fifty times last week. I would never have survived otherwise.

Viking metal is stronger than sleep.

I usually sleep for 8.5 hours a night. I thought that for this week I could be tricky, starting at 04:00 and sleeping later and later so I'd only have to sleep six times for maybe eight hours a pop. Not only did it totally work, but my wake times didn't advance as fast as my bedtimes, so I only lost 6.38 hours per day to sleep.

I thought this would make me tired and unable to concentrate on difficult programming, but energy and focus were actually really good except for one hour early Sunday night. I blame it on epic Viking metal and other super-energizing music, plus maybe the seven bars of 90% dark chocolate I ate. I had one or two cups of tea but no other caffeine, and I woke without an alarm every morning.

It's euphoric to never have to stop coding.

I hadn't realized I how much more I enjoy coding when I don't have to answer emails for a week. (Note the unread emails climb to 402 by the end.) Even fixing bugs, supporting Internet Explorer, and struggling with algorithms I don't understand are all fun when I know I'm going to win--that I'll solve the thing before anything can distract me. And listening to music is one of my favorite things, so having a week filled with just code and music? Wonderful!

I speed up the longer I go.

Normally, I work a focused-but-relaxed 60 hours in a week. I doubled that last week, but I feel like I was perhaps three times as productive. I could keep the problems in my head without cache eviction due to memory pressure. (I mean, there wasn't anything else to think about.) With ever-deepening focus, I felt unstoppable. It was like getting 4.5 40-hour weeks' worth of work done in one.

How much did you actually get done?

It's hard to compare, but here are the major projects I did:

    
  • Moved all game Systems out of the codebase and into the database with live-coding System editing from within the level editor
  • Completely redesigned and rewrote the spell editor, in the process solving 31 Trello tasks that depended on a new editor architecture
  • With Scott, wrote a parser for vector sprite assets that allows us to use vector art directly in our game engine instead of exporting raster sprite sheets
  • Implemented automatic, dynamic nav mesh generation to support A*-based pathfinding for any unit's artificial intelligence
  • Added support for Internet Explorer 9-11 (and 9 doesn't even have web workers!)
  • Moved all world victory condition configuration from code to configurable scripts, refactoring the goal management to allow more flexible goals



On top of those major projects, most of the work was in all the little Trellos I slew and bugs I fixed.

Okay, but was the code any good?

Yes. It's expressive, well-organized, and (to me) pretty, if not solid or fast yet. But...

My coding style changed.

Most nights last week I programmed in my dreams, with vivid Tetris effect one night of doing CSS tweaks. (One night I had a nightmare of watching a YouTube video and then panicking upon realizing I wasn't working.) Being that deep into my CoffeeScript, I found myself writing terser and terser code, since why do in five lines what you can obviously do in one? But as I coded, I didn't realize until too late that "obvious" is different between just-spent-120-hours-coding me and just-went-skateboarding me, let alone people are not me and may not even know CoffeeScript if you can believe that. Here's an example from spell_view.coffee:

I don't even want to show you what the old code was, because it was uglier than a cowbear. But it was three times this long and did half as much. To me, this new code is luscious. But can a sane coder really understand this? Where are all the commas and braces and parentheses clarifying the operator and method call and array precedence?

Processor speed changes everything.

I had the idea to do this week a few months ago, but I wanted to wait until I could buy a freshly updated MacBook Pro to do it, since the old one was three years old and, though capable, pretty slow. After the laptop upgrade, I was surprised by how much more I wanted to work. The simple friction of slow builds and poor CodeCombat level simulation performance had been weighing down my enjoyment and efficiency this whole time. I'm never waiting three years to upgrade my gear again.

This was a weird thing to do.

Man barely moves for a week, staring at patterns of light on a flat object and trying to make the patterns change. Every 2-4 hours, a stimulus is presented and he records how happy he is. He eats and sleeps as fast as he can so he can go back to looking at the lights.

It is the happiest week he has ever recorded by a wide margin.

(I have been tracking happiness for over three years, and this week's average of 7.03 / 10 is a full 0.22 points higher than the week I first started writing my book and learned to skateboard. Now, probably the best weeks are weeks when I wasn't at my computer consistently recording happiness pings, like the week I got married which was pretty much the best ever.)

Overall, it was surprisingly easy.

I think it would be much harder if I was under any stress (like deadlines), but this was just fun, and there were never any points when I wanted to stop working. I don't think I could hit these kind of hours without trying to set a personal record, though. (My previous record was only 87.3 hours.) I doubt I could have focused on only coding, rejecting all other activities, if I wasn't making a public precommitment and time lapse video of it.

I talked about my preparations and planning in the previous post, which is exactly how it went down except that I kept waking up early. I asked for predictions as to how much I could do; friends guessed I'd do anywhere from 87.3 - 113 hours, with an average of 99.4. My wife Chloe wins the competition by guessing 113 (which was even higher than my own secret prediction of 112). So getting to 120.75 feels like an epic victory to me. Although my workweek offcially ended at 03:59, I couldn't go to sleep until 04:45 because I was so excited.

Final stats can be found in the last frame:

Here are some stats that Telepath Logger doesn't show:

    
  • Average happiness: 7.03 / 10 (awesome!)
  • Energy: 6.64 (high for me)
  • Health: 5.33 (5 is "okay")
  • 90% chocolate bars eaten: 7
  • Daily work average: 17.25 hours
  • Hours awake but not working (eating): 2.6 (0:22 per day)
  • Hours sleeping: 44.65 (6.38 per day, 7.44 per night)
  • Seconds per frame: 55



Oh, and if you're wondering about the videos showing while I'm sleeping: it's just my screensaver. I extracted still frames from some other YouTube videos with ffmpeg at 705 frames per second so that when played back in real time at three frames every seven seconds split across three screens, the main screen would produce a thirty-frame-per-second rerendering of the videos in time-lapse time.

Nick

Hacking on CodeCombat, a multiplayer programming game for learning to code. Mastermind behind Skritter, the most powerful Chinese character learning app.

More posts from

Hacking
Bantling: Name Your Baby With Algorithms

When Chloe and I were trying to come up with baby names, every conversation would go something like this:Chloe: "New...

Read more...
My .emacs

Emacs wizards will tell you that it is not merely a text editor, but an operating system; not just a way to work, bu...

Read more...
The 120-Hour Workweek - Epic Coding Time-Lapse

Last week I set out to see how many hours of programming work I could do in one week on CodeCombat, our multiplayer ...

Read more...
Upcoming Maniac Week

Starting Monday morning at 04:00, and ending the next Monday at 03:59, I'm going to see how many hours of CodeCombat...

Read more...
Telepath Logger Now Open Source

A while ago I was working with Yoni on Telepath, a project to make your laptop do passive machine learning on your e...

Read more...

All Topics