I'm not sure if this is right forum to ask, please don't kill me if it isn't.

I'm using Visual Studio C++ Express 2010.
I found that different setting in project properties can lead to big difference in performance of application. My app was running at 140 FPS, I changed few things and it jumped to 410!!

So, which options should I use to maximize program speed?


Basically, optimization flags play a big role in increasing the performance of an application.

You need to first make sure you compile under "Release" mode, which will disable debugging hooks and features (so you won't be able to stop the program with break-points and step through it). Those debugging hooks are not necessary once you have finished debugging the application.

Then, you can enable a number of optimizations. Basically, you can choose between fast code ( /O2 ) or small code ( /O1 ). And you can also enable global optimizations ( /GL ). In general, the fastest code is generated with the /Ox compilation flag. I'm not familiar enough with Visual C++ build option menus to direct you to where you can change those settings, but you get the general idea: go through the build options and enable anything that says "optimization". At worst, you can add /Ox to the custom compilation flags (somewhere in the menus). Here is a complete list of compilation flags for MSVC. Here is an overview of high-end optimizations in MSVC. Basically, if you have knowledge of your architecture's hardware accelerations, you can specify that in order to make use of them to increase performance.

After disabling debugging and enabling all optimizations, your program should function exactly the same as before, just a lot faster (4-5 times faster). If it doesn't work correctly anymore, then you have bugs in your program.

commented: Perfect answer. Thank you very much. +0
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.