Precompute
Precomputing is a close relative of caching. When you cache a result, you pay the price of computing it once in the performance-critical path. When you precompute, you don't even pay the first time. You perform the precomputation outside the performance-critical path (say, initialization-time) and never pay the price of performing a costly computation inside the performance-critical path.
Back to the Web server implementation for an example: A Web server spends a significant portion of its time manipulating character strings. If you can speed up string manipulation, performance will rise significantly. One string manipulation task we often encountered was uppercasing strings and characters. If the browser sends us an "Accept:" request ...
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