I have created a Class Library (called as GNGEngine.dll) which performs some image processing stuff. This dll contains a function ProcessBitmap() as the main function to do searching for specific pattern. I have tested the engine by creating anothers forms application and taking the reference of the dll. I am calling the ProcessBitmap() method of dll by clicking on the button. The forms application takes 8secs to process the image completely.
Now as per clients requirement i have created an exe (console application) file GNGEngineRunner.exe which takes the image filename as the argument. I have created the object of dll class and called the method ProcessBitmap() and passed the file for its processing. The same image now takes almost a minute to its processing.
Is there any specific reason, why it is taking too much time?
Thanks for sharing your valuable time.
First of all you should attach a profiler to see what is happening. If you don’t have one you can use the trial version at http://www.red-gate.com/products/dotnet-development/ants-performance-profiler/
Visual Studio has a performance profiler built in, but depending on your VS version it could be anything from nonexistant, crappy or good.
Second, there should be no reason for this. I would guess that the problem is that you have exceptions being thrown because of reference to a non-existing form/GUI-object or similar. Execution-wise Console or WinForm is 100% the same and you can even mix them in one app. The only difference is some references and the fact that you create a console window instead of a form.
Feel free to add more details and possibly some code.