There is aso the option of rolling your own version even if a particular service is already available 一rtmcstaesoeeaeeeRakeTeaagahop the time. unrolling lifting stant expre itat all.For ultimateconroyou have to take coding matters into your own hands. Our Goal Many books and articles have xtoled the virtes ofas a language supporting the paradigm.C+ onsto complex problems [CE95] creating hi and r will len ion.One important issue,however,has received little attention:run-time efficienc rspective of programming toavod them without compromising the crity licityof your,the high cce solu tion is frequently also the simplest s should also help opers and the inherent superiority of the paradig.famous physicist once said that an ex rt is one who as mad all possible n akes in a very na Although maki learning from f others (the h A secondary goal of this book is to construct a one-stop shop for C++performance issues.As a C++ oper,the ans ers to your perfo e not readily av alable.The are scattered over a h this s pu ther self.Not ng to do that.We are to b helpfhvso sop thatfosirly on the imorant to of Software Efficiency:Does It Matter? ed doubles 18 months(Moor about need to efficiency is still a prominent concem.In 1971,the Intel 4004 was the first cor nercial proc a mi 18 of ssor issue would have been re ations.Wh TearxiFlyxi There is also the option of rolling your own version even if a particular service is already available in a library. Libraries are often designed with flexibility and reusability in mind. Often, flexibility and reusability trade off with performance. If, for some critical code fragment, you choose to put performance considerations above the other two, it might be reasonable to override a library service with your own home-grown implementation. Applications are so diverse in their specific needs, it is hard to design a library that will be the perfect solution for everybody, everywhere, all the time. • Compiler optimizations Simply a more descriptive name than “miscellaneous,” this category includes all those small coding tricks that don’t fit in the other coding categories, such as loop unrolling, lifting constant expressions out of loops, and similar techniques for elimination of computational redundancies. Most compilers will perform many of those optimizations for you. But you cannot count on any specific compiler to perform a specific optimization. One compiler may unroll a loop twice, another will unroll it four times, and yet another compiler will not unroll it at all. For ultimate control, you have to take coding matters into your own hands. Our Goal Many books and articles have extolled the virtues of C++ as a language supporting the OO paradigm. C++ is positioned as the latest cure for the software crisis. For those not familiar with the term, the software crisis is our current inability to develop code that is simple enough to be understood, maintained, and extended by a mere mortal, yet powerful enough to provide solutions to complex problems [CE95]. Developers who migrate from other structured languages to C++ have been bombarded with information pertaining to the use of C++ in creating highly flexible and reusable code that will lend itself nicely to easy maintenance and extension. One important issue, however, has received little attention: run-time efficiency. We will examine the relevant performance topics from the perspective of C++ programming. After reading this book you should emerge with a clear understanding of the common C++ performance pitfalls and how to avoid them without compromising the clarity and simplicity of your design. In fact, the highperformance solution is frequently also the simplest solution. This book should also help developers produce C++ code as efficient as its C counterpart while still benefiting from the extended features of C++ and the inherent superiority of the OO paradigm. A famous physicist once said that an expert is one who has made all possible mistakes in a very narrow field. Although making mistakes is a good way to learn, learning from the mistakes of others (the authors, in this case) is even better. A secondary goal of this book is to construct a one-stop shop for C++ performance issues. As a C++ developer, the answers to your performance concerns are not readily available. They are scattered over a long list of books and magazine articles that address different pieces of this puzzle. You would have to research this topic and put it all together yourself. Not many developers are going to do that. We are too busy. It will be helpful to have a one-stop shop that focuses entirely on the important topic of C++ performance. Software Efficiency: Does It Matter? In an era where processor speed doubles every 18 months (Moore's law), do we really need to worry about software efficiency? The fact is that regardless of phenomenal advances in chip technology, software efficiency is still a prominent concern. In 1971, the Intel 4004 was the first commercial processor to fit on a single chip. It was named a microprocessor. Since then, microprocessor technology has embarked on a 25-year streak of doubling processor speed every 18 months. Today's microprocessors are tens of thousands of times faster than the Intel 4004. If processor speed was the answer to inefficient software, the issue would have been resolved and long forgotten. Yet, software efficiency is still a concern with most development organizations. Why? TEAMFLY Team-Fly®