优化代码 [英] optimized code

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

问题描述

托管C ++编译器是否仍会产生比C#编译器好得多的优化,或者已经推出了一些更多的b / b
全局/主动优化进入2005编译器?


简单的常见子表达式和循环不变量是否在

当前优化器中优化了?


谢谢,

m

Is it still true that the managed C++ compiler will produce much better
opimizations than the C# compiler, or have some of the more
global/aggressive opimizations been rolled into the 2005 compiler?

Are simple common sub-expressions and loop invariants optimized out in the
current optimizer?

thanks,
m

推荐答案



" Mike" < 6 ******** @ yahoo.com>在消息中写道

新闻:Oj **************** @ TK2MSFTNGP10.phx.gbl ...

"Mike" <vi********@yahoo.com> wrote in message
news:Oj****************@TK2MSFTNGP10.phx.gbl...
它还在吗?确实,托管C ++编译器将产生比C#编译器更好的选择,或者是否已经将一些更多的全局/主动优化设置引入2005编译器?
Is it still true that the managed C++ compiler will produce much better
opimizations than the C# compiler, or have some of the more
global/aggressive opimizations been rolled into the 2005 compiler?




是的,托管C ++编译器应该仍然更好。无论如何,C#编译器仍然无法进行优化,AFAIK也不会走得太远。它们被留给了JIT。



Yes, the Managed C++ compiler should still be better. the C# compiler still
doesn''t go very far as far as optimizations go, AFAIK anyway. They are left
to the JIT.




Daniel O''Connell [C#MVP]" ; < onyxkirx @ - NOSPAM--comcast.net>写在

消息新闻:eN **************** @ TK2MSFTNGP09.phx.gbl ...

"Daniel O''Connell [C# MVP]" <onyxkirx@--NOSPAM--comcast.net> wrote in
message news:eN****************@TK2MSFTNGP09.phx.gbl...

是的,托管C ++编译器应该仍然更好。 C#编译器
在优化过程中仍然没有走得太远,AFAIK无论如何。他们将被留给JIT。

Yes, the Managed C++ compiler should still be better. the C# compiler
still doesn''t go very far as far as optimizations go, AFAIK anyway. They
are left to the JIT.




谢谢。好吧,我想我不在乎编译器是否具有魔力,或者

JIT。

我假设JIT仅限于窥视孔优化? JIT是否处理

常见的子表达式删除,循环不变等等?


如果我有一个类似的内循环:

for(i ...){

abcx = ...

abcy = ...

abcarr [i] =

...

}


我是否需要将abc放在循环外的本地,或者是JIT拿这个?b $ b关心这个?

有时用这种方式代码更干净,有时候不行 - 但是还有

auto生成的代码,以及我是否需要生成带有临时值的代码。


谢谢



Thanks. Well, I guess I don''t care if the compiler does the magic, or the
JIT.
I assume the JIT is limited to peephole optimizations? Does the JIT handle
common sub-expression removal, loop invarients, etc?

If I have an inner loop of something like:
for ( i ...) {
a.b.c.x = ...
a.b.c.y = ...
a.b.c.arr[i] =
...
}

Do I need to put a.b.c in a local outside the loop, or will the JIT take
care of this?
Sometimes it''s cleaner to code this way, sometimes not - but there''s also
auto-generated code, and whether I need to generate code with temps.

thanks


有趣,重新:托管C ++:
http:// msdn。 microsoft.com/msdnmag/is...Optimizations/

" Mike" < 6 ******** @ yahoo.com>在消息中写道

news:ui **************** @ TK2MSFTNGP10.phx.gbl ...
Interesting, re: managed C++:
http://msdn.microsoft.com/msdnmag/is...Optimizations/
"Mike" <vi********@yahoo.com> wrote in message
news:ui****************@TK2MSFTNGP10.phx.gbl...

Daniel O''Connell [C#MVP]" < onyxkirx @ - NOSPAM--comcast.net>在消息新闻中写道:eN **************** @ TK2MSFTNGP09.phx.gbl ...

"Daniel O''Connell [C# MVP]" <onyxkirx@--NOSPAM--comcast.net> wrote in
message news:eN****************@TK2MSFTNGP09.phx.gbl...

是的,托管C ++编译器应该仍然更好。 C#编译器
在优化过程中仍然没有走得太远,AFAIK无论如何。他们将被留给JIT。

Yes, the Managed C++ compiler should still be better. the C# compiler
still doesn''t go very far as far as optimizations go, AFAIK anyway. They
are left to the JIT.



谢谢。好吧,我想我不在乎编译器是否具有魔力或者JIT。
我认为JIT只限于窥视孔优化? JIT是否处理常见的子表达式删除,循环不变等等?

如果我有一个内部循环,例如:
for(i ...){
abcx = ...
abcy = ...
abcarr [i] =
...
}

我需要吗?将abc放在循环外的本地,或JIT是否会对此进行处理?
有时以这种方式编码更清晰,有时候不是 - 但也有
自动生成的代码,以及是否需要生成带有临时值的代码。

感谢



Thanks. Well, I guess I don''t care if the compiler does the magic, or the
JIT.
I assume the JIT is limited to peephole optimizations? Does the JIT
handle common sub-expression removal, loop invarients, etc?

If I have an inner loop of something like:
for ( i ...) {
a.b.c.x = ...
a.b.c.y = ...
a.b.c.arr[i] =
...
}

Do I need to put a.b.c in a local outside the loop, or will the JIT take
care of this?
Sometimes it''s cleaner to code this way, sometimes not - but there''s also
auto-generated code, and whether I need to generate code with temps.

thanks



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

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