Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Performance Gains with Visual Studio Whole Program Optimization

Our product is a library which we deliver as a dll or static library. I've noticed that using Whole Program Optimization in Visual Studio improves the performance around 30%. This is good but referring to http://blogs.msdn.com/b/vcblog/archive/2009/02/24/quick-tips-on-using-whole-program-optimization.aspx I see that it is not suggested to use whole program optimization for libraries that are delivered to customers.

The same article mentions around 3-4% improvement in performance. Now that we see 10 times of the expected performance gain, I am thinking whether we are doing something wrong.

Not sure how to formulate this but I'll give it a try: Apparently our code base has a "problem" that WPO can solve very well. Whatever this "problem" (or problems?) is , it is less important in other software hence WPO has relatively small impact. Now my question is what might be this problem? We would like to optimize our code manually since turning on WPO is not an option.

like image 739
tks Avatar asked Jan 03 '14 12:01

tks


People also ask

What does optimize code do in Visual Studio?

The Optimize option enables or disables optimizations performed by the compiler to make your output file smaller, faster, and more efficient.

How do I turn off Optimization in Visual Studio?

Open the project's Property Pages dialog box. For details, see Set C++ compiler and build properties in Visual Studio. Select the Configuration Properties > C/C++ > Optimization property page. Modify the Optimization property.

Why is Visual Studio so heavy?

This is mainly because Visual Studio has lots of components, extensions and tools.

How does compiler optimize code?

Compiler optimization is generally implemented using a sequence of optimizing transformations, algorithms which take a program and transform it to produce a semantically equivalent output program that uses fewer resources or executes faster.

What do the Visual Studio Performance Recommendations mean?

Visual Studio performance recommendations are intended for low memory situations, which may occur in rare cases. In these situations, you can optimize certain Visual Studio features that you may not be using. The following tips are not intended as general recommendations.

How can I optimize performance during debugging sessions?

If you are typically running low on memory during debugging sessions, you can optimize performance by making one or more configuration changes. The simplest optimization is to enable the Just My Code feature, which only loads symbols for your project.

Is Visual Studio Code (vs Code) performance affected by extensions?

Visual Studio Code (VS Code) is designed to be lightweight. It has a tight set of core features, and you can add extra features through extensions. But performance will inevitably be affected as your collection of extensions grows. Do you evaluate the performance of an extension before installing it?

How much faster is Visual Studio 2019 compared to 2017?

Stepping through your code is over 50% faster in Visual Studio 2019 versus 2017. The Watch, Autos, and Locals windows are 70% faster. Moreover, since most debugger-related windows (i.e. watch window, call stack window, etc.) are now asynchronous, you can now interact with one window in Visual Studio while waiting for information to load in another.


1 Answers

Probably, you have some functions called many times, which can't be inlined without WPO due to being defined in source files. You can use a profiler to identify these, then move them into headers and mark them inline.

like image 120
Mike Seymour Avatar answered Oct 03 '22 21:10

Mike Seymour