When writing, optimise the algorithm not the code

iStock_000002948110XSmall

Back when I used to be a programmer, I quickly learned that you could get a much bigger performance boost by changing the algorithm – the underlying structure of the code and data – than by optimising the code.

For example, you could rewrite an inner loop in assembler rather than C and get a 20% speed-up but it would take a lot of work and be difficult to maintain. Changing the way you did it, for example, using a more efficient sort algorithm or a smarter data structure would produce a 100% speed-up. It would also be easier to support, comment, bug fix and update.

Similarly, if you dropped a feature, you could drop the code for that feature. Non-existent code doesn’t crash, doesn’t require testing, doesn’t need a manual, doesn’t need comments or maintenance. In fact, non-existent code is the best code there is. It forces you to focus on the stuff that makes the game fun rather than the code that adds unnecessary or distracting features.

It’s the same today with writing:

  • Put your effort on the most important points and delete the rest.
  • Change the way you structure a piece before you start trying to polish individual sentences.
  • To reduce word count, cut paragraphs first, then sentences and only then cut words.
  • Don’t chase features. Chase meaning.

, , ,

9 Responses to When writing, optimise the algorithm not the code

  1. SM Schmidt February 19, 2010 at 8:58 pm #

    Your point about how blissful non-existent code can be when trying to improve the work spoke volumes for me.

    • Matthew Stibbe February 23, 2010 at 6:54 am #

      Thanks for commenting on my blog. The saying “non-existant code doesn’t crash” is probably the most valuable thing I learned from ten years running a software company! :)

  2. Dean Rieck February 22, 2010 at 11:51 pm #

    Brilliant. This is the single smartest thing I’ve read all day. Work from big to small. I’ve always believed that what you say is more important than how you say it (an idea I stole from Ogilvy), and this post says that nicely.

    • Matthew Stibbe February 23, 2010 at 6:53 am #

      @Dean Thanks for the kind words. Glad you liked my post. :) Matthew

  3. Hugo Moolenaar March 7, 2010 at 9:05 am #

    Matthew, this is a brilliant peace of advice, thanks for that!
    “The non-existent code”, worth putting on my ‘wall of inspiration’ at my workplace. It’s up there now! Might save me a lot of trouble & explaining…

    • Matthew Stibbe March 7, 2010 at 9:43 am #

      @Hugo. I’m glad you like it. It really is one of the most useful things I learned from my programming days. If in doubt, leave it out! Radical simplicity works for so many other areas of life but most geeks, gamers and ‘experts’ think that ‘more is better.’ Even the saying ‘less is more’ reveals the same false assumption. It would be more accurate to say ‘less is better’.

  4. Galina April 7, 2010 at 9:48 am #

    Hi Matthew,
    could you advise me if there are average prices in UK on rewriting content for web-sites (let’s say an agricultural company has facts on which it wants to build creative and emotional text). And how are those prices usually calculated (per syllable, page, etc.)? Thank you very much in advance.

    • Matthew Stibbe April 7, 2010 at 3:44 pm #

      There’s a ‘rate for the job’ page on the NUJ website but that’s mainly for journalism. I don’t know so much about web content. Perhaps a Google search might find something – let me know if you find anything useful.

      • Galina April 9, 2010 at 2:33 pm #

        Matthew, thanks a lot for the ‘rate for the job’ page on NUJ, it was very helpful.

Leave a Reply