启动VS探查提高应用程序性能20倍? [英] Launching VS Profiler boosts Application Performance x20?

查看:189
本文介绍了启动VS探查提高应用程序性能20倍?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

修改1
我不排除这一切可能是通过使用探查器(在我的正规的项目的一些错误的设定)的一些非常基本的副作用引起的

我想提高计算时间在我的应用程序,所以我决定要经过一个透彻的剖析分析。 因此,我刚刚推出的.Net内存分配性能分析分析我的应用程序。
我完全惊呆了,观看更快速的计算旅途X20倍

I wanted to improve Computing Time in my Application, so I decided to go through a thorough profiling analysis. So I just launched a .Net Memory Allocation Profiling to analyze my App.
I was completely stunned to watch computing go x20 times faster !

应用程序包括从二进制文件中读取的数据与BackgroundWorkers,对它们进行处理,
并将结果存储到一个MSSQL数据库。每一轮通常需要20秒,而分析它几乎需要1秒。我检查并确保结果是一致的在这两种情况下。

Application consists of Reading Data from Binary Files with BackgroundWorkers, process them,
and store results into an MSSQL DB. Each round usually takes 20 seconds, and while profiling it barely takes 1 sec. I checked and made sure results are coherent in both cases.

在.NET尝试的朋友告诉我的探查优化线程和莫名其妙,通过螺纹锁和瓶颈寻找它的道路,但我就是不能相信。

A .Net experimented friend told me the profiler optimizes threading and "somehow" finds its way through thread Locks and Bottlenecks, but I just can't believe it.

所以,我的问题是:

     
  1. 到底发生了什么,如何,为什么
  2. ?  
  3. 如何让我的code作用一样本身?

编辑2
我KNOW 这听起来很疯狂,令人难以置信。我自己还是很suspicious.But这是真的。
同样的code运行非常快由监视运行时。 我用的是相同的测试数据,并观看了相同的计算输出。 我不能给出一个简单的再现项目,因为它是一个比较大的框架。 我使用的是Visual Studio 2010的探查。

我会给予尽可能多的细节,我可以对流量肯定会当我发现它发布一个线索。

EDIT 2
I KNOW this sounds crazy and unbelievable. I myself am still very suspicious.But it's TRUE.
The SAME code runs really fast when run by the profiler. I use the SAME test data, and watch the SAME computing output. I am not able to give out a simple reproducing project, as it is a relatively big framework. I am using the Visual Studio 2010 Profiler.

I'll be giving as much details as I can on the flow and definitely will post a clue as soon as I find it.

常规运行日志:
2011年3月23日18时04分34秒| 180434.621 |模拟SET [5] - [1] - [5 PC-1 0 SET 1/48]
2011年3月23日十八时05分01秒| 180501.271 | 办理时间:00:00:26.6515244
等。

Regular RUN LOGS :
03/23/2011 18:04:34 | 180434.621 | SIMULATING SET [5]-[1]-[5 PC-1 0 [SET 1/48]
03/23/2011 18:05:01 | 180501.271 | PROCESSING TIME : 00:00:26.6515244
etc..

探查运行日志:
2011年3月24日11时38分15秒| 113815.592 |模拟SET [5] - [1] - [5 PC-1 0 SET 1/48]
2011年3月24日11点38分十七秒| 113817.350 | 办理时间:00:00:01.7581005

等。

Profiler Run LOGS :
03/24/2011 11:38:15 | 113815.592 | SIMULATING SET [5]-[1]-[5 PC-1 0 [SET 1/48]
03/24/2011 11:38:17 | 113817.350 | PROCESSING TIME : 00:00:01.7581005

etc..

修改3:线索
OK OK OK我不好(我警告过上编辑1这种可能性,因为这太令人难以置信。很抱歉)@Watts建议检查,如果我是在调试或发布模式。 那是我早就做了。但@SnowBear指出,有两种不同的事情:运行的软件调试版本和下运行调试器软件 我确信,当前配置是否释放这两个构建和执行力是VS2010。不过,正如我正要坚果我决定直接在bin /释放的exe文件启动应用程序。瞧...过程中服用,每次1秒。 运行探查器让你离开调试模式(无论你在释放或调试模式下) 这就是把我的困惑。
感谢所有侦探柯南。

EDIT 3 : The Clue
Ok ok ok My BAD(I warned on such a possibility on edit 1, as this was too unbelievable. Sorry) @Watts suggested to check if I was in debug or release mode. Which I had Already done. BUT @SnowBear pointed out that there are two different things : to run debug version of software and to run a software under debugger I made sure that the active configuration was RELEASE in both Build And Execution is VS2010. However, as I was just going nuts I decided to launch the Application directly from the exe file in the bin/release. And voilà... processes were taking 1 second each. Running the Profiler get you out of debug mode (whether you're in release or debug mode) that's what put me into confusion.
Thanks to All Case Closed.

推荐答案

与调试运行禁用JIT优化。如果您平时运行exe JIT优化将被启用。将调试器附加到这样一个正在运行的应用程序允许您将它与启用优化调试。

Running with the debugger disables jit optimizations. If you run the exe normally jit optimizations will be enabled. Attaching a debugger to such a running application allows you to debug it with enabled optimizations.

发布版本VS调试,构建有两种后果:

Release-Build vs Debug-Build has two consequences:

  1. 在有条件的编译器标志是(联合国)定义
  2. 在它允许/禁止在C#优化=> IL汇编。

这篇关于启动VS探查提高应用程序性能20倍?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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