Chapter 11: The Need for Speed
Mull It Over
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 ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access