This bugzilla service is closed. All entries have been migrated to
Bug 1670 - Performance degradation of matrix multiplication inside for cycle in 3.3 compared to 3.2
Summary: Performance degradation of matrix multiplication inside for cycle in 3.3 comp...
Alias: None
Product: Eigen
Classification: Unclassified
Component: Core - matrix products (show other bugs)
Version: 3.3 (current stable)
Hardware: x86 - 64-bit Windows
: Normal Performance Problem
Assignee: Nobody
Depends on:
Reported: 2019-01-25 16:53 UTC by Leonid Grechishnikov
Modified: 2019-12-04 18:25 UTC (History)
2 users (show)

Benchmark for matrix multiplication (1.01 KB, text/plain)
2019-01-25 16:53 UTC, Leonid Grechishnikov
no flags Details

Description Leonid Grechishnikov 2019-01-25 16:53:41 UTC
Created attachment 919 [details]
Benchmark for matrix multiplication

Attached is a benchmark which works slower with Eigen 3.3 than with Eigen 3.2. Performance degradation is observed at least for MSVC (~2-3 times slower) and Intel Compiler (~1.5-3 times slower).

It seems that matrix-vector or vector-vector multiplication inside for cycle is worse optimized by compiler since version 3.3 (less functions are inlined).

Processor: Intel(R) Core(TM) i7-7700 CPU @ 3.6GHz 3.60 GHz
Memory (RAM): 16.0 GB
Windows 10 x64

Visual Studio 2017 with MSVC compiler command line:
/GS /W1 /Zc:wchar_t /I"C:\Users\lgrechishnikov\source\repos\TestEigenPerformance\TestEigenPerformance" /Zi /Gm- /O2 /Fd"x64\Release\vc141.pdb" /Zc:inline /fp:precise /errorReport:prompt /WX- /Zc:forScope /Gd /MD /FC /Fa"x64\Release\" /EHsc /nologo /Fo"x64\Release\" /Fp"x64\Release\TestEigenPerformance.pch" /diagnostics:classic

Visual Studio 2017 with Intel Compiler 2018 command line:
/GS /W1 /Zc:wchar_t /I"C:\Users\lgrechishnikov\source\repos\TestEigenPerformance\TestEigenPerformance" /Zi /O2 /Fd"x64\Release\vc141.pdb" /fp:precise /Zc:forScope /MD /FC /Fa"x64\Release\" /EHsc /nologo /Fo"x64\Release\" /Qprof-dir "x64\Release\" /Fp"x64\Release\TestEigenPerformance.pch"

Processing times:

MSVC, Eigen 3.2.4 - 5.0 ms
MSVC, Eigen 3.3.7 - 16.2 ms

Intel Compiler, Eigen 3.2.4 - 4.52 ms
Intel Compiler, Eigen 3.3.7 - 17.17 ms
Comment 1 Gael Guennebaud 2019-01-27 15:44:11 UTC
Indeed both MSVC and ICC struggle to properly inline some functions. Of course, no problem with clang and gcc:

To workaround this issue you can try to add EIGEN_STRONG_INLINE to the functions that are not properly inlined until compiler gets happy.
Comment 2 Nobody 2019-12-04 18:25:22 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance:

Note You need to log in before you can comment on or make changes to this bug.