如何在 g++ 中使用配置文件引导优化?

How to use profile guided optimizations in g++?(如何在 g++ 中使用配置文件引导优化?)
本文介绍了如何在 g++ 中使用配置文件引导优化?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

另外,谁能给我指出一个关于这个主题的好教程?我找不到.

Also, can anyone point me to a good tutorial on the subject? I can't find any.

推荐答案

-fprofile-generate 将使用分析代码检测应用程序.如果在编译时知道这种使用模式,应用程序将在实际运行时记录可以提高性能的某些事件.可以记录分支、内联的可能性等,但我不确定 GCC 是如何实现这一点的.

-fprofile-generate will instrument the application with profiling code. The application will, while actually running, log certain events that could improve performance if this usage pattern was known at compile time. Branches, possibility for inlining, etc, can all be logged, but I'm not sure in detail how GCC implements this.

程序退出后,会将所有这些数据转储到 *.gcda 文件中,这些文件本质上是用于测试运行的日志数据.使用 -fprofile-use 标志重建应用程序后,GCC 在优化时会考虑 *.gcda 日志数据,通常会显着提高性能.当然,这取决于很多因素.

After the program exits, it will dump all this data into *.gcda files, which are essentially log data for a test run. After rebuilding the application with -fprofile-use flag, GCC will take the *.gcda log data into account when doing its optimizations, usually increasing the performance significantly. Of course, this depends on many factors.

这篇关于如何在 g++ 中使用配置文件引导优化?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!

相关文档推荐

Rising edge interrupt triggering multiple times on STM32 Nucleo(在STM32 Nucleo上多次触发上升沿中断)
How to use va_list correctly in a sequence of wrapper functions calls?(如何在一系列包装函数调用中正确使用 va_list?)
OpenGL Perspective Projection Clipping Polygon with Vertex Outside Frustum = Wrong texture mapping?(OpenGL透视投影裁剪多边形,顶点在视锥外=错误的纹理映射?)
How does one properly deserialize a byte array back into an object in C++?(如何正确地将字节数组反序列化回 C++ 中的对象?)
What free tiniest flash file system could you advice for embedded system?(您可以为嵌入式系统推荐什么免费的最小闪存文件系统?)
Volatile member variables vs. volatile object?(易失性成员变量与易失性对象?)