TAILIEUCHUNG - Optimizing C++

This book contains guidelines and advices on how to write efficient software using the C++ language. Software correctness and maintainability are taken into account, but are not the primary concerns of the guidelines. Most of the guidelines presented are not platform specific, and so are applicable to every processor, to every compiler, and to every operating system; the few platform specific advices try to cover most platforms. | 1. Optimizing software in C An optimization guide for Windows Linux and Mac platforms By Agner Fog. Copenhagen University College of Engineering. Copyright 2004 - 2012. Last updated 2012-02-29. Contents 1 Introduction. The costs of optimizing. 2 Choosing the optimal platform. Choice of hardware platform. Choice of microprocessor. Choice of operating system. Choice of programming language. Choice of compiler. Choice of function libraries. Choice of user interface framework. Overcoming the drawbacks of the C language. 3 Finding the biggest time consumers. How much is a clock cycle . Use a profiler to find hot spots. Program installation. Automatic updates. Program loading. Dynamic linking and position-independent code. File access. System database. Other databases. Graphics. Other system resources. Network access. Memory access. Context switches. Dependency chains. Execution unit throughput. 4 Performance and usability. 5 Choosing the optimal algorithm. 6 Development process. 7 The efficiency of different C constructs. Different kinds of variable storage. Integers variables and operators. Floating point variables and operators. Enums. Booleans. Pointers and references. Function pointers. Member pointers. Smart pointers. Arrays. Type conversions. Branches and switch statements. Loops. Function Function return Structures and Class data members properties .51 Class member functions methods .52 Virtual member Runtime type identification RTTI .53 Constructors and Overloaded Overloaded Exceptions and error Other cases of stack .