Book description
NoneTable of contents
- Preface
- 1. An Overview of Optimization
-
2. Computer Behavior Affecting Optimization
- Lies C++ Believes About Computers
-
The Truth About Computers
- Memory Is Slow
- Memory Is Not Accessed in Bytes
- Some Memory Accesses Are Slower than Others
- Memory Words Have a Big End and a Little End
- Memory Has Finite Capacity
- Instruction Execution Is Slow
- Making Decisions Is Hard for Computers
- There Are Multiple Streams of Program Execution
- Calling into the Operating System Is Expensive
- C++ Tells Lies Too
- Summary
- 3. Measure Performance
-
4. Optimize String Use: A Case Study
- Why Strings Are a Problem
-
First Attempt at Optimizing Strings
- Use Mutating String Operations to Eliminate Temporaries
- Reduce Reallocation by Reserving Storage
- Eliminate Copying of String Arguments
- Eliminate Pointer Dereference Using Iterators
- Eliminate Copying of Returned String Values
- Use Character Arrays Instead of Strings
- Summary of First Optimization Attempt
- Second Attempt at Optimizing Strings
- Eliminate String Conversion
- Summary
- 5. Optimize Algorithms
- 6. Optimize Dynamically Allocated Variables
-
7. Optimize Hot Statements
-
Remove Code from Loops
- Cache the Loop End Value
- Use More Efficient Loop Statements
- Count Down Instead of Up
- Remove Invariant Code from Loops
- Remove Unneeded Function Calls from Loops
- Remove Hidden Function Calls from Loops
- Remove Expensive, Slow-Changing Calls from Loops
- Push Loops Down into Functions to Reduce Call Overhead
- Do Some Actions Less Frequently
- What About Everything Else?
-
Remove Code from Functions
- Cost of Function Calls
- Declare Brief Functions Inline
- Define Functions Before First Use
- Eliminate Unused Polymorphism
- Discard Unused Interfaces
- Select Implementation at Compile Time with Templates
- Eliminate Uses of the PIMPL Idiom
- Eliminate Calls into DLLs
- Use Static Member Functions Instead of Member Functions
- Move Virtual Destructor to Base Class
- Optimize Expressions
- Optimize Control Flow Idioms
- Summary
-
Remove Code from Loops
-
8. Use Better Libraries
- Optimize Standard Library Use
- Optimize Existing Libraries
-
Design Optimized Libraries
- Code in Haste, Repent at Leisure
- Parsimony Is a Virtue in Library Design
- Make Memory Allocation Decisions Outside the Library
- When in Doubt, Code Libraries for Speed
- Functions Are Easier to Optimize than Frameworks
- Flatten Inheritance Hierarchies
- Flatten Calling Chains
- Flatten Layered Designs
- Avoid Dynamic Lookup
- Beware of âGod Functionsâ
- Summary
- 9. Optimize Searching and Sorting
- 10. Optimize Data Structures
- 11. Optimize I/O
- 12. Optimize Concurrency
- 13. Optimize Memory Management
- Index
Product information
- Title: Optimized C++
- Author(s):
- Release date:
- Publisher(s): O'Reilly Media, Inc.
- ISBN: None
You might also like
book
Refactoring: Improving the Design of Existing Code
Fully Revised and Updated–Includes New Refactorings and Code Examples “Any fool can write code that a …
audiobook
Fall in Love with the Problem, Not the Solution
Unicorns-companies that reach a valuation of more than $1 billion-are rare. Uri Levine has built two. …
book
Modern Software Engineering: Doing What Works to Build Better Software Faster
Improve Your Creativity, Effectiveness, and Ultimately, Your Code In Modern Software Engineering, continuous delivery pioneer David …
book
Tidy First?
Messy code is a nuisance. "Tidying" code, to make it more readable, requires breaking it up …