Chapter 11: The Need for Speed

Mull It Over

  1. Optimization is a process of making trade-offs—sacrificing one quality of code for another desirable quality. Describe the kinds of trade-offs that lead to a performance increase.

The kinds of decisions that profoundly influence a program’s performance are:

  • Number of features versus size of code

  • Program speed versus memory consumption

  • Storage and caching versus computation on demand

  • Guarded approach versus unguarded; optimistic versus pessimistic

  • Approximate calculations versus exact calculations

  • Inline versus function call; monolithic versus modular

  • Indexing an array versus searching a list

  • Passing a parameter by reference or address versus passing a copy

  • Implemented in hardware versus software

  • Hard-coded, direct ...

Get Code Craft 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.