More efficient C ++ Reading Notes 15

Source: Internet
Author: User

Item 16: Keep in mind the 80-20 criterion (80-20 rule) 80-20 criterion that about 20% of Code uses 80% of program resources; about 20% of the Code consumes about 80% of the running time; about 20% of the Code uses 80% of the memory; about 20% of the Code executes 80% of the disk access; 80% of maintenance is invested in about 20% of the code, and has been verified by experiments on numerous machines, operating systems, and applications. The 80-20 criterion is not only a well-remembered idiom, but also a guideline on system performance. It has extensive applicability and a solid experimental foundation. When thinking about the 80-20 criterion, do not confuse the specific number. Some people prefer the stricter 90-10 criterion, and there is some experimental evidence to support it. Regardless of the exact number, the basic idea is the same: the overall performance of the software depends on a small part of the code composition. This chapter describes how to locate the code that affects the performance bottleneck of 20%. It is not difficult to improve efficiency. It is rare to find the correct performance bottleneck. There are two methods. One is speculation or screen experience judgment, and the other is accurate measurement using profile tools. The two methods are of course more scientific and credible. Using the profile tool to provide the most effective data for testing, finding the program bottleneck is one of the advanced skills that a programmer needs to master.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.