Running Faster, Getting Smaller

Every program can be made to run faster or to use less memory.

Many programmers claim to be able to predict what makes a program fast or slow, big or small. However, experience shows that programmers are not usually good at guessing in advance which parts of their programs will cause performance problems. And often, by trying to optimize a program prematurely, a programmer will not only create a slower, larger program, but will also make it unreadable and unmaintainable.

The best course is to create a well-structured program and then use tests to find what's slow or big. This enables you to focus on the features of C++ while programming and thus build a program that is less likely to need dramatic optimization.

Keep in mind that most performance optimization consists of trade-offs. You can increase the speed at which a program runs, but you may have to make it bigger or use more memory to accomplish this.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.220.254.4