Chris, one of our fabulous programmers and avid promoter of pub lunches, has written a deliciously nerdy blog post over on The Lab. What the heck is The Lab? Why it’s a section of this site that we set up for just this purpose, and then promptly ignored / forgot all about / were too busy making games to update it. Well no longer friends! For at least one more post has been written, and it’s a goodun!
In the post, Chris talks to us about doing exactly the right amount of work, specifically in terms of writing algorithms that don’t do more than they should. It begins like this, so you know it’s good:
The other day I was writing some code that needed to build up a list of strings in a large file, and identify any duplicates that occurred. On average, the file would contain about 10000 unique strings, and I’d be looking at finding at least 500 duplicates per string. That means that throughout the parsing of my file, I’d have to add about 10000 strings to the list, and probably do about 5000000 lookups on them. This needed to be a fast process…
Go on over and dive into the lab, your brain will be bigger as a result and that’s a fact!*.
*Not a guaranteed fact.