17. Optimization

When I was younger, I learned somewhere the Three Golden Rules of Optimization. They are as follows:

  (I)    Don’t do it!

  (II)    Don’t do it!

  (III)    Only for experts: Don’t do it (yet).

I still think this is the most important advice you can give concerning optimization. Way too many people spend way too much time optimizing code although they shouldn’t—or at least they’re optimizing in all the wrong places. And optimization is not only useless work 99% of the time, it also usually makes the code harder to read and maintain and can introduce bugs.

So, in a way you shouldn’t read this chapter at all. Or only if you you’re absolutely sure that you really, really need it. And then you should start with Recipes 17-1 and ...

Get Common Lisp Recipes: A Problem-Solution Approach now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.