Avatar of Gordon Saxby
Gordon SaxbyFlag for United Kingdom of Great Britain and Northern Ireland

asked on 

Why does program run faster in Visual Studio than compiled exe

I have a C# console program, developed in Visual Studio Premium 2013. When I start the program in Visual Studio - either with or without debugging - it runs significantly faster than if I run the compiled EXE. I have tried both the "Debug" and "Release" compiled EXE's.

The difference is huge - 5 seconds when running in VS against 50+ seconds running as an EXE. That is the time for 1 "job", eventually, this application needs to process around 2000+ jobs!

In both cases, I am running from the same computer and using the same config file.

How can there be such a massive difference and why would running within VS be faster?! I must be missing something significant!?
Microsoft DevelopmentC#

Avatar of undefined
Last Comment
Gordon Saxby
ASKER CERTIFIED SOLUTION
Avatar of Éric Moreau
Éric Moreau
Flag of Canada image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Avatar of Gordon Saxby
Gordon Saxby
Flag of United Kingdom of Great Britain and Northern Ireland image

ASKER

Yes, it is connecting to one server to extract data, it then processes that data and writes it to another server. The connections are all defined in its config file ... so both instances should be doing exactly the same thing. I have checked that the config file is correct.

It seems like the connections to the other servers are taking the most time, when running the exe - but is hardly noticeable when running in Visual Studio.
Avatar of Éric Moreau
Éric Moreau
Flag of Canada image

strange. I am clueless!
SOLUTION
Avatar of kaufmed
kaufmed
Flag of United States of America image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
SOLUTION
Avatar of Zoppo
Zoppo
Flag of Germany image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
Avatar of Gordon Saxby
Gordon Saxby
Flag of United Kingdom of Great Britain and Northern Ireland image

ASKER

I have been using "cmder" to run the program, but today noticed that the timings for the same set of test data varied. I then ran the program against the same data, using the normal "cmd" DOS window.

The cms window is always faster than the cmder window, however, the times do vary and it now looks like it is a network / source system (Microsoft CMS) issue.

Running the program using "Start without Debugging" in Visual Studio is still the fastest (!?), but running the exe now appears to be nearly as fast. As this does not appear to be a Visual Studio / coding issue, I will close this question.

Thanks for all the suggestions.
C#
C#

C# is an object-oriented programming language created in conjunction with Microsoft’s .NET framework. Compilation is usually done into the Microsoft Intermediate Language (MSIL), which is then JIT-compiled to native code (and cached) during execution in the Common Language Runtime (CLR).

98K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo