微软速度优化的问题 [英] problem with microsoft speed optimization

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

问题描述

你好。


我遇到了Visual Studio .net(2003)C ++速度问题优惠,并希望有人可以建议解决方法。


我的项目包含许多C ++文件,其中大部分都可以正常工作

优化开启。但是,至少有一个没有,尽管它确实打开了尺寸优化的
。我不知道具体是什么

优化器出错了,只是输出不正确。而且我在大约10行内知道
问题所在。我已经尝试过重新排列有问题的行(这是直接的C代码)。我已经尝试使用''volitle''数据类型来避免优化。

我已经找到了缺少的变量初始化,但是所有内容看起来都是

正确而直截了当。


一个解决方案就是有一个预编译器指令,它只能在
启用(或禁用)优化时使用具体文件。当然

我可以手动打开和关闭优化,同时重新编译

特定文件,但我需要一些自动化的东西。


我不能发布代码,但会尝试跟进一个测试用例

表现出相同的行为。


据推测,程序会编译很好用g ++,但不幸的是

这个项目不是一个选项。


非常感谢。


马克

Hello.

I''m having a problem with the Visual Studio .net (2003) C++ speed
optimization, and hope someone can suggest a workaround.

My project includes many C++ files, most of which work fine with speed
optimization turned on. At least one does not however, though it does
work with size optimization turned on. I don''t know specifically what
the optimizer is doing wrong, just that the output is incorrect. And I
know within about 10 lines where the problem is. I''ve tried
rearranging the offending lines (which are straight C code). I''ve
tried using ''volitle'' data types in hopes of avoiding optimization.
I''ve looked for missing variable initializations, but everything looks
correct and straightforward.

One solution would be to have a precompiler directive which would
enable (or disable) the optimization only on specific files. Of course
I can manually turn the optimization on and off while recompiling
specific files, but I need something automated.

I can''t post the code, but will try to follow up with a test case that
exhibits the same behavior.

Presumably the program would compile fine with g++, but unfortunately
that''s not an option for this project.

Thanks very much.

Mark

推荐答案



mjbackues at yahoo写道:

mjbackues at yahoo wrote:
您好。

我遇到了Visual Studio .net(2003)C ++速度优化的问题,希望有人可以提出解决方法。

我的项目包含许多C ++文件,其中大部分都可以在启用速度优化时正常工作。但是,至少有一个没有,尽管它确实可以打开大小优化。我不知道优化器出错了什么,只是输出不正确。我在大约10行内知道问题所在。我已经尝试重新排列有问题的行(这是直接的C代码)。我试图使用''volitle''数据类型以避免优化。
我已经找到了缺少的变量初始化,但所有内容看起来都是正确和直接的。

一种解决方案是使用预编译器指令,该指令将仅对特定文件启用(或禁用)优化。当然
我可以在重新编译特定文件时手动打开和关闭优化,但我需要自动化的东西。

我不能发布代码,但会尝试跟进一个表现出相同行为的测试用例。

大概该程序可以用g ++编译好,但遗憾的是这不是这个项目的选项。
Hello.

I''m having a problem with the Visual Studio .net (2003) C++ speed
optimization, and hope someone can suggest a workaround.

My project includes many C++ files, most of which work fine with speed
optimization turned on. At least one does not however, though it does
work with size optimization turned on. I don''t know specifically what
the optimizer is doing wrong, just that the output is incorrect. And I
know within about 10 lines where the problem is. I''ve tried
rearranging the offending lines (which are straight C code). I''ve
tried using ''volitle'' data types in hopes of avoiding optimization.
I''ve looked for missing variable initializations, but everything looks
correct and straightforward.

One solution would be to have a precompiler directive which would
enable (or disable) the optimization only on specific files. Of course
I can manually turn the optimization on and off while recompiling
specific files, but I need something automated.

I can''t post the code, but will try to follow up with a test case that
exhibits the same behavior.

Presumably the program would compile fine with g++, but unfortunately
that''s not an option for this project.




听起来你在询问你的
编译器优化器的特殊行为。如果是这样,那么你问的是错误的群体。

是这里建议的VC ++ .Net小组。

http://www.parashift.com/c++-faq-lit...t.html#faq-5.9


Gavin Deane



It sounds like you''re asking about the particular behaviour of your
compiler''s optimiser. If so, then you are asking the wrong group. There
is a VC++ .Net group suggested here.

http://www.parashift.com/c++-faq-lit...t.html#faq-5.9

Gavin Deane


好的,谢谢。

OK, thanks.

mjbackues写道:
mjbackues at yahoo wrote:
你好。

我遇到了Visual Studio .net(2003)C ++速度问题
优化,并希望有人可以建议一个解决方法。


这个主题在这个组中是偏离主题的,它只与

有关* standard * C ++。请参阅常见问题解答,了解主题内容以及

一些更好的发布地点的建议:

http://www.parashift.com/c++-faq-lit...t.html #faq-5.9

我的项目包含许多C ++文件,其中大部分都可以在启用速度优化时正常工作。但是,至少有一个没有,尽管它确实可以打开大小优化。我不知道优化器出错了什么,只是输出不正确。我在大约10行内知道问题所在。我已经尝试重新排列有问题的行(这是直接的C代码)。我试图使用''volitle''数据类型以避免优化。
我已经找到了缺少的变量初始化,但所有内容看起来都是正确和直接的。


人们常常责怪编译器出现奇怪的错误,但通常会发现用户错误,或许是在显然无关的部分

该计划。您是否尝试查看生成的汇编代码?

一种解决方案是使用预编译器指令,该指令仅对特定文件启用(或禁用)优化。当然
我可以在重新编译特定文件时手动打开和关闭优化,但我需要自动化的东西。


在编译器文档中查找#pragma。更好的是,完全关闭优化器
(除了内联等)。看到这个

文章,优化:你最糟糕的敌人:

http://www.codeproject.com/tips/optimizationenemy.asp


另请参阅Surviving the Release Version ;:

http://www.codeproject。 com / debug / survivalreleasever.asp

我不能发布代码,但会尝试跟进一个表现出相同行为的测试用例。


您应该在发布之前完成此操作。请参阅常见问题解答:

http://www.parashift.com/c++-faq-lit...t.html#faq-5.8


但是,当然,如果您事先阅读了常见问题解答,那么您可以将

发布到不同的新闻组中。 ;-)

大概这个程序可以用g ++编译好,但不幸的是,这不是这个项目的选项。
Hello.

I''m having a problem with the Visual Studio .net (2003) C++ speed
optimization, and hope someone can suggest a workaround.
This subject matter is off-topic in this group, which is solely
concerned with *standard* C++. See the FAQ for what is on-topic and for
some suggestions of better places to post:

http://www.parashift.com/c++-faq-lit...t.html#faq-5.9
My project includes many C++ files, most of which work fine with speed
optimization turned on. At least one does not however, though it does
work with size optimization turned on. I don''t know specifically what
the optimizer is doing wrong, just that the output is incorrect. And I
know within about 10 lines where the problem is. I''ve tried
rearranging the offending lines (which are straight C code). I''ve
tried using ''volitle'' data types in hopes of avoiding optimization.
I''ve looked for missing variable initializations, but everything looks
correct and straightforward.
People often blame the compiler for strange errors, but it usually
turns out to be user error, perhaps in an apparently unrelated part of
the program. Have you tried looking at the generated assembly code?
One solution would be to have a precompiler directive which would
enable (or disable) the optimization only on specific files. Of course
I can manually turn the optimization on and off while recompiling
specific files, but I need something automated.
Look up #pragma in your compiler documentation. Better yet, turn off
the optimizer altogether (except for inlining and such). See this
article, "Optimization: Your Worst Enemy":

http://www.codeproject.com/tips/optimizationenemy.asp

See also "Surviving the Release Version":

http://www.codeproject.com/debug/survivereleasever.asp
I can''t post the code, but will try to follow up with a test case that
exhibits the same behavior.
You should have done this before posting. See the FAQ:

http://www.parashift.com/c++-faq-lit...t.html#faq-5.8

But, of course, if you had read the FAQ in advance, you would have
posted to a different newsgroup to begin with. ;-)
Presumably the program would compile fine with g++, but unfortunately
that''s not an option for this project.




这种无懈可击的猜测完全没有用。如果可能的话,你的b $ b应至少尝试代码中的问题点和你拥有的任何其他

编译器。您可以使用相同的蒸馏

代码,这些代码很快就会发布,这可能会产生一些

有用的结果。


干杯! --M



Such warantless speculation is entirely unhelpful. If possible, you
should try at least the problem spot in your code on that and any other
compiler you have at your disposal. You could use the same distilled
code that you''ll be posting shortly, and that might generate some
helpful results.

Cheers! --M


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

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