Synopses & Reviews
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.
Includes bibliographical references (p. 293-295) and index.
About the Author
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.
Table of Contents
(Each chapter concludes with Key Points.
Roots of Software Inefficiency.
Software Efficiency: Does It Matter?
Organization of This Book.
1. The Tracing War Story.
Our Initial Trace Implementation.
What Went Wrong.
The Recovery Plan.
2. Constructors and Destructors.
3. Virtual Functions.
Virtual Function Mechanics.
Templates and Inheritance.
4. The Return Value Optimization.
The Mechanics of Return-by-Value.
The Return Value Optimization.
Pass by Value.
Return by Value.
Eliminate Temporaries with op=().
6. Single-Threaded Memory Pooling.
Version 0: The Global new() and delete().
Version 1: Specialized Rational Memory Manager.
Version 2: Fixed-Size Object Memory Pool.
Version 3: Single-Threaded Variable-Size Memory Manager.
7. Multithreaded Memory Pooling.
Version 4: Implementation.
Version 5: Faster Locking.
8. Inlining Basics.
What Is Inlining?
Method Invocation Costs.
Inlining Virtual Methods.
Performance Gains from Inlining.
9. Inlining—Performance Considerations.
Why Not Inline?
Development and Compile-Time Inlining
10. Inlining Tricks.
Inlining with Static Local Variables.
Architectural Caveat: Multiple Register Sets.
11. Standard Template Library.
Better than STL?
12. Reference Counting
Concurrent Reference Counting.
13. Coding Optimizations.
80-20 Rule: Speed Up the Common Path.
Library and System Calls.
14. Design Optimizations.
Web Server Timestamps.
The Common Code Trap.
Efficient Data Structures.
The SMP Architecture.
Multithreaded and Synchronization Terminology.
Break Up a Task into Multiple Subtasks.
Cache Shared Data.
16. System Architecture Dependencies
Registers: Kings of Memory.
Disk and Memory Structures.
Prefer Simple Calculations to Small Branches.