Application runs very slow in debug mode

c#, debugging, performance, visual-studio-2013

Solution

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>

Problem

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?

Original source