Performance Issue changing from 3.2.8 to 3.3beta1

Submitted by neu..@..eck.de

Assigned to Nobody

Link to original bugzilla bug (#1181)
Version: 3.3 (current stable)
Platform: x86 - 64-bit

Description

I wanted to try out Eigen 3.3beta1 and found that my code was running approx. ten times slower than with Eigen 3.2.8

By playing around with the code I found that it will also be slow in Eigen 3.2.8 if const is removed from the line "const Vector3d yi{ tmpyi };"

Testcode: (Inlcude eigen/core und chrono)

int main(int argc, char** argv)
{
using namespace Eigen;

Matrix3d rot, rott;  
rot << 0, 0, 1,  
	1, 0, 0,  
	0, 1, 0;  
rott << rot.transpose();  

const double Prefactor1 = 1.5456;  
const double Prefactor2 = 3.5456;  
Vector3d tmpyi;  
tmpyi << 2, 1, 9;  

const Vector3d yi{ tmpyi };  
  
std::chrono::time_point<std::chrono::high_resolution_clock, std::chrono::nanoseconds> det_init_begin, det_init_finished;  
det_init_begin = std::chrono::high_resolution_clock::now();  
Matrix3d tmp;  
for (int i = 0; i < 1000000; ++i)  
{  
	tmp = (Prefactor1*(rot*yi.asDiagonal()*rott*-1 * rott + rott*yi.asDiagonal()*rot*rot) + Prefactor2*(yi.asDiagonal()*Matrix3d::Ones()*yi.asDiagonal()));  
	tmp;  
}  
tmp;  

det_init_finished = std::chrono::high_resolution_clock::now();  
std::cout << "It took " << (det_init_finished - det_init_begin).count() / 1E6 << " ms to calc 10^6 values " << std::endl << std::endl;  
    system("pause");  
    return 0;  

}

Blocking

#558 (closed)

Edited by Eigen Bugzilla