编译器优化 [英] Compiler optimizations

查看:72
本文介绍了编译器优化的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

单词!


如果这里有任何gcc用户,也许你可以帮帮我。我有一个

程序,我尝试用-O2和-O3优化来编译它。

设置。


有线的事情是它实际上使用-O2比使用-O3运行得更快,

即使-O3是更高的优化设置。


我找到了gcc中的bug?我可能做错了吗?


干杯。

Word up!

If there are any gcc users here, maybe you could help me out. I have a
program and I''ve tried compiling it with -O2 and -O3 optimization
settings.

The wired thing is that it actually runs faster with -O2 than with -O3,
even though -O3 is a higher optimization setting.

Have I found a bug in gcc? Could I be doing something wrong?

Cheers.

推荐答案

sammy写道:

....
sammy wrote:
....

如果这里有任何gcc用户,也许你可以帮帮我。我有一个

程序,我尝试用-O2和-O3优化来编译它。

设置。


有线的事情是它实际上使用-O2比使用-O3运行得更快,

即使-O3是更高的优化设置。


我找到了gcc中的bug?我可能做错了吗?
If there are any gcc users here, maybe you could help me out. I have a
program and I''ve tried compiling it with -O2 and -O3 optimization
settings.

The wired thing is that it actually runs faster with -O2 than with -O3,
even though -O3 is a higher optimization setting.

Have I found a bug in gcc? Could I be doing something wrong?



这两个问题的答案都是可能。不知道你的代码的详细信息和gcc优化策略的细节,

我们不能肯定。对于使用特定输入的特定程序,一般来说优化的东西可以很容易地为b
而不是
悲观化。


对于gcc问题,我建议使用专门用于gcc的论坛;这个

不是。

The answer to both questions is "possibly". WIthout knowing the
details of your code AND the details of gcc''s optimization strategies,
we can''t be sure. Something that is in general an optimization could
easily, for a specific program using specific inputs, be a
pessimization instead.

For gcc issues, I''d recommend using a forum specialized for gcc; this
isn''t it.


1月15日,3:43 * pm,sammy< s .. 。@ noemail.spamwrote:
On Jan 15, 3:43*pm, sammy <s...@noemail.spamwrote:

Word up!


如果这里有gcc用户,也许你可以帮助我出。我有一个

程序,我尝试用-O2和-O3优化来编译它。

设置。


有线的事情是它实际上使用-O2比使用-O3运行得更快,

即使-O3是更高的优化设置。


我找到了gcc中的bug?我可能做错了吗?
Word up!

If there are any gcc users here, maybe you could help me out. I have a
program and I''ve tried compiling it with -O2 and -O3 optimization
settings.

The wired thing is that it actually runs faster with -O2 than with -O3,
even though -O3 is a higher optimization setting.

Have I found a bug in gcc? Could I be doing something wrong?



更高的优化级别只是意味着要求编译器使用更多深奥类型的优化技巧。无法保证

{例如} -O1比-O0更快。

以内联为例...它可能会使代码运行因为函数调用减少了b / b
或者它可能会使代码变得如此之大以至于以前用于缓存的东西已经不再适用了。

我建议你将GCC

编译器的特定性能问题直接发送到GCC编译器新闻组。


PS

通过使用配置文件

引导优化,您可以使用最新版本的GCC获得良好的结果。

Higher optimization levels just means that compilers are requested to
use more esoteric types of optimization tricks. There is no guarantee
that {for instance} -O1 is faster than -O0 for that matter.
Take the example of inlining... It may make the code run faster due to
reduced function calls or it may make the code so large that stuff
that used to fit in the cache no longer does.

I suggest you direct specific performance problems with the GCC
compiler to the GCC compiler newsgroups.

P.S.
You can get good results with recent versions of GCC by using profile
guided optimization.


ja ********* @ verizon.net 写道:

sammy写道:

...
sammy wrote:
...

>如果这里有任何gcc用户,也许你可以帮帮我。我有一个
程序,我已经尝试用-O2和-O3优化
设置进行编译。

有线的事情是它实际上运行速度比-O2快使用-O3,
即使-O3是更高的优化设置。

我是否在gcc中发现了一个错误?我可能做错了吗?
>If there are any gcc users here, maybe you could help me out. I have a
program and I''ve tried compiling it with -O2 and -O3 optimization
settings.

The wired thing is that it actually runs faster with -O2 than with -O3,
even though -O3 is a higher optimization setting.

Have I found a bug in gcc? Could I be doing something wrong?



这两个问题的答案都是可能。不知道你的代码的详细信息和gcc优化策略的细节,

我们不能肯定。对于使用特定输入的特定程序,一般来说优化的东西可以很容易地为b
而不是
悲观化。


对于gcc问题,我建议使用专门用于gcc的论坛;这个

不是吗。


The answer to both questions is "possibly". WIthout knowing the
details of your code AND the details of gcc''s optimization strategies,
we can''t be sure. Something that is in general an optimization could
easily, for a specific program using specific inputs, be a
pessimization instead.

For gcc issues, I''d recommend using a forum specialized for gcc; this
isn''t it.



他可能会对系统上的量子效应感到困惑

计时器。


-

[邮件]:Chuck F(cinefalconer at maineline dot net)

[page]:< http://cbfalconer.home.att.net>

尝试下载部分。


-

通过 http://www.teranews.com

And he may be getting confused by the quantum effects on the system
timer.

--
[mail]: Chuck F (cbfalconer at maineline dot net)
[page]: <http://cbfalconer.home.att.net>
Try the download section.

--
Posted via a free Usenet account from http://www.teranews.com


这篇关于编译器优化的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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