Saturday, March 23, 2013

HPS source size over time

When I joined Cincom in 2007, source code cleanup for our VM was one of the first priorities for engineers because cruft was getting too much in our way.  This cleanup might sound easy to do, but it takes a large amount of effort precisely because so much cruft had accumulated.  What tends to happen is that one thing leads to another and all of a sudden what was meant as a removal of an obsolete feature involves investigating how every compiler in use reacts to various code constructs.  And then you also find bugs that had been masked by the code you're trying to remove, and these require even more time to sort out.

From a features point of view, it's unrewarding work because at the end of the day you have what you had before.  The key difference, which becomes observable over time, is that when you put in this kind of work then support call volume starts going down, random crashes stop happening, and the code cruft doesn't get in your way so you don't even have to research it.  As a result, the fraction of time you can spend adding new features goes up.

We've been at it for over 6 years now, and we can clearly see the difference in our everyday work.  Take a look:

  • VW 7.4 (2005): 337776 LOC.
  • VW 7.4 (2005): 338139 LOC.
  • VW 7.4a (2006): 358636 LOC.
  • VW 7.4b (2006): 358957 LOC.
  • VW 7.4c (2006): 359419 LOC.
  • VW 7.4d (2006): 358782 LOC.
  • VW 7.5 (2007): 358921 LOC.
  • VW 7.6 (2007): 357264 LOC.
  • VW 7.6a (2008): 350093 LOC.
  • VW 7.7 (2009): 345618 LOC.
  • VW 7.7a (2010): 270093 LOC.
  • VW 7.7.1 (2010): 270124 LOC.
  • VW 7.7.1a (2010): 270119 LOC.
  • VW 7.8 (2011): 261580 LOC.
  • VW 7.8a (2011): 261611 LOC.
  • VW 7.8b (2011): 261739 LOC.
  • VW 7.8.1a (2011): 261748 LOC.
  • VW 7.9 (2012): 252309 LOC.
  • VW 7.10 (2013): 240880 LOC (March).
As you can see, from the high water mark of 359419 LOC to today's 240880 LOC, we have removed 33% of the VM's source code.  Think of it: wouldn't it be nice to drop a third of your source code while killing a ton of bugs and adding new features?  Also, using the standard measuring stick of "400 page book" = "20k LOC", we can see HPS went from requiring 18 to 12 books.

We still have more code deletions queued up for 7.10, which are associated with various optimizations and bug fixes.  With a bit of luck, we'll reach 12k LOC (that is, about 240 printed pages) deleted in this release cycle.

Update: we went into code freeze in preparation for 7.10.  Here's an update on the code deletion.
  • VW 7.10 (2013): 240368 LOC (April code freeze).
Another 500 LOC bit the dust since March, and the VM executable became a couple kilobytes smaller too.  Finally, we're at basically 12k LOC deleted for the whole release.

Update 2: we gained about 500 LOC for 7.10, but only in exchange for IPv6 functionality.  I'll update the LOC count later since we know there are a few more fixes that will go in.