Re: [eigen] MSVC bad inlining behavior

[ Thread Index | Date Index | More Archives ]

Hi Patrik,

Thank you for the suggestion. I've reported it to Microsoft:
Naturally, this does not solve issue for my current work environment (and people who might still need to build for older Microsoft compilers).

Best regards,


From: Patrik Huber <patrikhuber@xxxxxxxxx>
Sent: Monday, March 26, 2018 01:34
To: eigen@xxxxxxxxxxxxxxxxxxx
Subject: Re: [eigen] MSVC bad inlining behavior
Hi Basil,

I'm just an Eigen user, but have you reported this to You can report it directly from within VS 2017.
Particularly if you have a self-contained, minimal example, like you do, I bet they would be very interested in it, and nowadays they are also very responsive and often even push fixes to release within one or two minor versions (a few months). Let me know the link if you do post it, I'd be curious to see where this goes.

Best regards,


On 25 March 2018 at 15:13, Basil Fierz <basil.fierz@xxxxxxxxxxx> wrote:

Hi Eigen developers,


I’m using Eigen (personally and professionally) for quite a few years, mainly to solve many small fixed-size problems. While the template _expression_ engine is a wonderful tool to optimize the generated code, it only works reasonable well using clang/gcc. Using MSVC we’re constantly running into the issue that a lot of code is not properly inlined, which in turn hurts performance massively.

The issue can usually be resolved by patching Eigen and replacing some ‘inline’ with ‘EIGEN_STRONG_INLINE’. I’ve collected some very simple examples which demonstrate the problem:


The example is compiled using MSVC 2017 and Clang 4. In each of them the former does not properly inline the calls, while Clang does.

There is a lot of other cases where this happens. The most frustrating ones are some where calls to ‘derived()’ are found in the code as they should essentially be no-ops. While I don’t see Eigen as a culprit, I would like to propose adapting Eigen to accommodate for the bad inlining engine of MSVC. Some time ago, I’ve created a PR which at least fixes the most annoying inlining problems for us:


I am open to different solutions for this problem. If adding ‘EIGEN_STRONG_INLINE’ to the core structures of Eigen, I will give it another more complete try.


Best regards,



Mail converted by MHonArc 2.6.19+