Use GCC to compile parameters to improve software Efficiency

Source: Internet
Author: User
Use GCC to compile parameters to improve software efficiency-Linux general technology-Linux programming and kernel information. The following is a detailed description. Note: using specific GCC parameters can greatly improve the execution efficiency of compiled programs.

Optimization Principle
During program compilation, the gcc parameters matching the system CPU are used by passing parameters. The compiled program is optimized for the system CPU, therefore, the execution speed and efficiency will be the best.

Notes
(1) After a large number of tests, it is found that in RedHat and CentOS systems, compilation and optimization can only be performed through the method passed by parameters. Of course, if you are willing to modify the MakeFile of the program, you can achieve this effect, but it is complicated and requires a lot of work. Other methods widely circulated on the Internet (for example, declaring the parameter system variables directly through. bashrc,/etc/profile, and writing/etc/make. conf) have no effect after tests .!

(2) For Gentoo Linux or FreeBSD, you can add parameters by modifying/etc/make. conf without passing parameters.

Optimization steps
(1) determine the system CPU type:
CODE: # cat/proc/cpuinfo | grep "model name"
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.