Efficient C++: Performance Programming Techniques / Edition 1

Efficient C++: Performance Programming Techniques / Edition 1

by Dov Bulka, David Mayhew
     
 

ISBN-10: 0201379503

ISBN-13: 9780201379501

Pub. Date: 10/29/1999

Publisher: Addison-Wesley

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

…  See more details below

Overview

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

Read More

Product Details

ISBN-13:
9780201379501
Publisher:
Addison-Wesley
Publication date:
10/29/1999
Edition description:
New Edition
Pages:
336
Product dimensions:
7.24(w) x 8.97(h) x 0.78(d)

Table of Contents

(Each chapter concludes with Key Points.)

Preface.

Introduction.

Roots of Software Inefficiency.

Our Goal.

Software Efficiency: Does It Matter?

Terminology.

Organization of This Book.

1. The Tracing War Story.

Our Initial Trace Implementation.

What Went Wrong.

The Recovery Plan.

2. Constructors and Destructors.

Inheritance.

Composition.

Lazy Construction.

Redundant Construction.

Key Points.

3. Virtual Functions.

Virtual Function Mechanics.

Templates and Inheritance.

Hard Coding.

Inheritance.

Templates.

4. The Return Value Optimization.

The Mechanics of Return-by-Value.

The Return Value Optimization.

Computational Constructors.

5. Temporaries.

Object Definition.

Type Mismatch.

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.

Why Inline?

Inlining Details.

Inlining Virtual Methods.

Performance Gains from Inlining.

9. Inlining—Performance Considerations.

Cross-Call Optimization.

Why Not Inline?

Development and Compile-Time Inlining

Considerations. Profile-Based

Inlining.

Inlining Rules.

Singletons.

Trivials.

10. Inlining Tricks.

Conditional Inlining.

Selective Inlining.

Recursive Inlining.

Inlining with Static Local Variables.

Architectural Caveat: Multiple Register Sets.

11. Standard Template Library.

Asymptotic Complexity.

Insertion.

Deletion.

Traversal.

Find.

Function Objects.

Better than STL?

12. Reference Counting

Implementation Details.

Preexisting Classes.

Concurrent Reference Counting.

13. Coding Optimizations.

Caching.

Precompute.

Reduce Flexibility.

80-20 Rule: Speed Up the Common Path.

Lazy Evaluation.

Useless Computations.

System Architecture.

Memory Management.

Library and System Calls.

Compiler Optimization.

14. Design Optimizations.

Design Flexibility.

Caching.

Web Server Timestamps.

Data Expansion.

The Common Code Trap.

Efficient Data Structures.

Lazy Evaluation.

getpeername().

Useless Computations.

Obsolete Code.

15. Scalability.

The SMP Architecture.

Amdahl’s Law.

Multithreaded and Synchronization Terminology.

Break Up a Task into Multiple Subtasks.

Cache Shared Data.

Share Nothing.

Partial Sharing.

Lock Granularity.

False Sharing.

Thundering Herd.

Reader/Writer Locks.

16. System Architecture Dependencies

Memory Hierarchies.

Registers: Kings of Memory.

Disk and Memory Structures.

Cache Effects.

Cache Thrash.

Avoid Branching.

Prefer Simple Calculations to Small Branches.

Threading Effects.

Context Switching.

Kernel Crossing.

Threading Choices.

Bibliography.

Index. 0201379503T04062001

Read More

Customer Reviews

Average Review:

Write a Review

and post it to your social network

     

Most Helpful Customer Reviews

See all customer reviews >