Efficient C++: Performance Programming Techniques

Front Cover
Addison-Wesley Professional, 2000 - Computers - 309 pages

Far too many programmers and software designers consider efficient C++ to be an oxymoron. They regard C++ as inherently slow and inappropriate for performance-critical applications. Consequently, C++ has had little success penetrating domains such as networking, operating system kernels, device drivers, and others.

Efficient C++ explodes that myth. Written by two authors with first-hand experience wringing the last ounce of performance from commercial C++ applications, this book demonstrates the potential of C++ to produce highly efficient programs. The book reveals practical, everyday object-oriented design principles and C++ coding techniques that can yield large performance improvements. It points out common pitfalls in both design and code that generate hidden operating costs.

This book focuses on combining C++'s power and flexibility with high performance and scalability, resulting in the best of both worlds. Specific topics include temporary objects, memory management, templates, inheritance, virtual functions, inlining, reference-counting, STL, and much more.

With this book, you will have a valuable compendium of the best performance techniques at your fingertips.

0201379503B04062001

 

What people are saying - Write a review

User Review - Flag as inappropriate

get the detail on the book

Contents

The Tracing War Story
13
Our Initial Trace Implementation
15
What Went Wrong
16
The Recovery Plan
19
Key Points
22
Constructors and Destructors
25
Inheritance
26
Composition
38
Find
167
Function Objects
169
Better than STL?
171
Key Points
174
Reference Counting
177
Implementation Details
179
Preexisting Classes
191
Concurrent Reference Counting
195

Lazy Construction
40
Redundant Construction
43
Key Points
48
Virtual Functions
49
Templates and Inheritance
53
Hard Coding
54
Inheritance
55
Templates
56
Key Points
57
The Return Value Optimization
59
The Return Value Optimization
61
Computational Constructors
64
Key Points
65
Temporaries
67
Type Mismatch
69
Pass by Value
71
Return by Value
72
Eliminate Temporaries with op
75
Key Points
76
SingleThreaded Memory Pooling
77
The Global new and delete
78
Specialized Rational Memory Manager
79
FixedSize Object Memory Pool
84
SingleThreaded VariableSize Memory Manager
89
Key Points
96
Multithreaded Memory Pooling
97
Faster Locking
100
Key Points
104
Inlining Basics
107
Method Invocation Costs
111
Why Inline?
117
Inlining Details
118
Inlining Virtual Methods
119
Performance Gains from Inlining
121
Key Points
122
Inlining Performance Considerations
123
Why Not Inline?
128
Development and CompileTime Inlining Considerations
131
ProfileBased Inlining
132
Inlining Rules
137
Trivials
138
Key Points
139
Inlining Tricks
141
Selective Inlining
143
Recursive Inlining
144
Inlining with Static Local Variables
149
Multiple Register Sets
151
Key Points
152
Standard Template Library
153
Insertion
154
Deletion
163
Traversal
165
Key Points
199
Coding Optimizations
201
Caching
203
Precompute
204
Reduce Flexibility
205
Speed Up the Common Path
206
Lazy Evaluation
210
Useless Computations
212
System Architecture
214
Memory Management
215
Library and System Calls
216
Compiler Optimization
219
Key Points
220
Design Optimizations
223
Caching
227
Web Server Timestamps
228
The Common Code Trap
229
Efficient Data Structures
231
Lazy Evaluation
232
getpeername
233
Useless Computations
236
Obsolete Code
237
Key Points
238
Scalability
241
The SMP Architecture
243
Amdahls Law
245
Multithreaded and Synchronization Terminology
247
Break Up a Task into Multiple Subtasks
248
Cache Shared Data
249
Share Nothing
252
Partial Sharing
254
Lock Granularity
256
False Sharing
258
Thundering Herd
259
ReaderWriter Locks
261
Key Points
262
System Architecture Dependencies
265
Memory Hierarchies
266
Kings of Memory
268
Disk and Memory Structures
271
Cache Effects
275
Cache Thrash
277
Avoid Branching
279
Prefer Simple Calculations to Small Branches
280
Threading Effects
281
Context Switching
284
Kernel Crossing
287
Threading Choices
288
Key Points
291
Bibliography
293
Index
297
Copyright

Common terms and phrases

About the author (2000)

Dov Bulka has spent fifteen years in the trenches of software development delivering large-scale software products to market. He was the performance architect of the IBM Domino-Go Web server that has powered some of the biggest Web sites ever hosted on the Internet, including that of the 1996 Atlanta Olympics. He received his Ph.D. in computer science from Duke University.

David Mayhew is Principal Architect of StarBridge Technologies, Inc., where he concentrates on interconnection fabrics, peer processing, and PCI bus evolution. Previously, he worked for IBM's Networking Software Division. He received his Ph.D. in computer science from Virginia Tech.



0201379503AB04062001

Bibliographic information