Visual Studio 2005 IDE中测试程序速问题

忙了大半天,总算是把beta卸了,2003也卸了,装好了2005 Pro版RTM。
立刻把DigitalImageProcessing的项目转到VS2005下。
结果没兴奋多久,发现在IDE里调程序慢得不行。
追查原因,发现是Gray8bppImage类在拖速度,这个类将一个Bitmap的像素一一转换为灰度,复制到一个byte[,]里。郁闷之余,离开IDE直接双击Debug目录下的exe执行,完全正常,速度满意。后来用Release试,结果一样。初步判定,VS2005 IDE里测试某些程序时,速度和直接运行相差极大。
注:Ctrl+F5(Start Without Debugging)没有此问题。
——————————————
测试环境
AthlonXP 2500+ oc 3200+ 
512MB DDR400 Dual Channel
Windows Server 2003 with SP1 and Oct 2005 updates installed
.NET Framework 2.0.50727
Visual Studio 2005 8.0.50727.42 RTM
 
测试方法,用DateTime.Now取执行开始和结束时间,相减得TimeSpan,以毫秒显示耗时。为了方便,没有采用多次测试取平均,下面给出典型结果,单位为毫秒。
————–Test1———————
测试内容:
for (int i = 0; i < 500000000; i++) ;
—————————————
IDE Debug: 984.375
IDE Release: 500
Shell Debug: 968.75
Shell Release: 484.375
结论:Release比Debug快很多,IDE比Shell慢一点。从编译优化的角度看这个结果非常和情理
————–Test1———————
测试内容:
Bitmap bmp = new Bitmap(400, 300);
            byte[,] b = new byte[bmp.Width, bmp.Height];
            for (int i = 0; i < bmp.Width; i++)
                for (int j = 0; j < bmp.Height; j++)
                {
                    b[i, j] = Utils.RGB2GreyLevel(bmp.GetPixel(i,j));
                }
————————————-
IDE Debug: 4828.125
IDE Release: 4765.625
Shell Debug: 171.875
Shell Release: 156.25
结论:Release比Debug快,IDE比Shell慢很多。不知道VS在干什么,真是难以理解!!!
 
上面是400*300的Bitmap,我程序里的图大得多,而且需要进行很多处理,等待时间可想而知,郁闷啊!探索中……
———————————-
Another description of this issue in English:
 
private void DoTest()
{
   Bitmap bmp = new Bitmap(400, 300);
   byte[,] b = new byte[400, 300];
   Color c;
   for (int i = 0; i < bmp.Width; i++)
     for (int j = 0; j < bmp.Height; j++)
     {
       c = bmp.GetPixel(i, j);
     }
}
This funtion takes as much as 5 seconds on my AthlonXP 3200+ when tested in
the VS2005 IDE.
But if you double-click the exe in the bin/debug(or release) directory, it
takes only 150ms!
What’s wrong with VS2005? (VS2003 doesn’t have such problems)
I’ve tried many options available but nothing could reduce the intolerably
long execution time.
 
Advertisements
This entry was posted in .NET. Bookmark the permalink.

6 Responses to Visual Studio 2005 IDE中测试程序速问题

  1. 筱玥 says:

    看不懂….

  2. jun says:

    最近也遇到这个问题,烦死了!

  3. Unknown says:

    wow gold!All wow gold US Server 24.99$/1000G on sell! Cheap wow gold,wow gold,wow gold,Buy Cheapest/Safe/Fast WoW US EU wow gold Power leveling wow gold from the time you wWorld of Warcraft gold ordered!

    wow power leveling wow power leveling power leveling wow power leveling wow powerleveling wow power levelingcheap wow power leveling wow power leveling buy wow power leveling wow power leveling buy power leveling wow power leveling cheap power leveling wow power leveling wow power leveling wow power leveling wow powerleveling wow power leveling power leveling wow power leveling wow powerleveling wow power leveling buy rolex cheap rolex wow gold wow gold wow gold wow gold -29650255619485

  4. Unknown says:

    wow gold!All wow gold US Server 24.99$/1000G on sell! Cheap wow gold,wow gold,wow gold,Buy Cheapest/Safe/Fast WoW US EU wow gold Power leveling wow gold from the time you wWorld of Warcraft gold ordered!

    wow power leveling wow power leveling power leveling wow power leveling wow powerleveling wow power levelingcheap wow power leveling wow power leveling buy wow power leveling wow power leveling buy power leveling wow power leveling cheap power leveling wow power leveling wow power leveling wow power leveling wow powerleveling wow power leveling power leveling wow power leveling wow powerleveling wow power leveling buy rolex cheap rolex wow gold wow gold wow gold wow gold -34656040147797

  5. Unknown says:

    wow gold!All wow gold US Server 24.99$/1000G on sell! Cheap wow gold,wow gold,wow gold,Buy Cheapest/Safe/Fast WoW US EU wow gold Power leveling wow gold from the time you wWorld of Warcraft gold ordered!

    wow power leveling wow power leveling power leveling wow power leveling wow powerleveling wow power levelingcheap wow power leveling wow power leveling buy wow power leveling wow power leveling buy power leveling wow power leveling cheap power leveling wow power leveling wow power leveling wow power leveling wow powerleveling wow power leveling power leveling wow power leveling wow powerleveling wow power leveling buy rolex cheap rolex wow gold wow gold wow gold wow gold -209992446047216

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s