Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Application runs very slow in debug mode

My C# program should execute an asynchronous task 30 times per second.

The program performs well as a standalone windows application.

But when it runs in debug mode in Visual Studio 2013 Professional environment the perfomance is very poor - just 5 tasks per second, even if there're no breakpoints in the code whatsoever.

Is slow debugging a "feature" of the VS.Net 2013 and is there a way to debug time critical C# apps?

like image 578
Vladimir Avatar asked Dec 09 '13 09:12

Vladimir


2 Answers

Thank You user1720293 for the idea about logging. The main reason for the huge perfomance drop was in logging to console through log4net.Appender.ConsoleAppender. After commenting out a line in the configuration file the problem has gone

  <root>
    <level value="DEBUG"/>
    <!-- here's the source of the problem
    <appender-ref ref="ConsoleAppender"/>
    -->
    <appender-ref ref="RollingFile"/>
  </root>
like image 120
Vladimir Avatar answered Oct 14 '22 09:10

Vladimir


I'd try eliminating a few things by: Removing all watch items Hiding the locals, autos window etc

Are you tracing out a lot of text? You could also try not doing that and see if it makes a difference.

Is visual studio left alone by your anti-virus software?

If it isn't pure c# code and c++ is involved anywhere then debugging performance is poor.

None of this is Visual Studio 13 specific advice. Did you previously run this code ok on 2012 or 2010?

like image 24
James_UK_DEV Avatar answered Oct 14 '22 10:10

James_UK_DEV