什么是C ++优化与开发?在Visual Studio中优化整个程序 [英] What's C++ optimization & Whole program optimizatoin in visual studio

查看:134
本文介绍了什么是C ++优化与开发?在Visual Studio中优化整个程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

本质上,我想知道什么是c ++优化(/O)&整个程序优化(/GL)就是这样.

Essentially I want to know what's c++ optimization (/O) & Whole program optimization (/GL) is all about.

将感谢您的深入解释.

谢谢

推荐答案

整个程序优化是跨模块优化的一个方面.由于这些语言的编译模型,在C和C ++上下文中,这也称为链接时优化.

Whole-program optimization is one aspect of cross-module optimization. This is also called link-time optimization in the context of C and C++, due to those languages' compilation models.

基本上,假设您的程序的 entire 源代码已粘贴到一个文件中,包括源文件,头文件和库文件,以及所有内容.在这种假设的情况下,编译器将有很多其他的优化机会:内联,清除死代码,重复数据删除等.

Basically, imagine that the entire source code of your program was pasted into one single file, source and header and library files, everything. In that hyptothetical case, the compiler would have a lot of additional opportunities for optimization: inlining, dead-code removal, deduplication, etc.

跨模块优化是指即使在C和C ++编译器惯用的传统的一次一次TU编译中也尝试允许此类优化的任何技术.通常,这涉及到在单个目标文件中添加额外的信息(甚至可能是整个已解析的源内容),并允许链接器在看到应用程序的所有成分目标文件后执行某些编译任务.

Cross-module optimization refers to any technique that attempts to allow such optimizations even within the traditional one-TU-at-a-time compilation that is customary to C and C++ compilers. Typically, this involves adding extra information (possibly even the entire parsed source content) into the individual object files and allowing the linker to perform certain compilation tasks once it sees all the ingredient object files for an application.

这篇关于什么是C ++优化与开发?在Visual Studio中优化整个程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆