c++eclipsevisual-studio-2010optimization

Win32 application (VS2010) runs much slow then a console in Eclipse (c++)


I have a project which I created in Eclipse c++. The project invokes a function that does a lot of loops (Thousands) to calculate the result.

When I run it in Eclipse it takes 1 minute (~70 seconds).

I wanted to add a GUI to the project so I opened a WinForm (Win32) project in VisualStudio2010 and moved all files of the project from the eclipse directory to the new directory (created for VS2010).

Now, when I run the form, the function takes 4-5 minutes. I tried to cancel the progress bar but it wasn't the problem, so I understood that long time is not because of the GUI.

I think the problem is in the compilation in VS2010. I tried to change some Optimizations properties, but the project couldn't be compiled...

How can I reduce the run time?


Solution

  • Basically you answered your own question:

    I think the problem is in the compilation in VS2010. I tried to change some Optimizations properties, but the project couldn't be compiled...

    however, it's hard to answer it, since there is a lot of optimization options in both of compilers, it's hard to tell what option makes it much faster/slower. It's also possible (and most probably is) that MS compiler just cant produce exactly the same or similar code to that of Eclipse's compiler.

    Your options is to "play" with optimization switches of the VS compiler and see if it helps. You can try to compare it's options to ones of the Eclipse to find differences, but most likely they will be just too different.

    As @Zuljin correctly mentioned also check you selected Win32 project, not CLR (Windows Forms) application. If you are using CLR project, then it's natural it will possibly run slower than Native program type.