Registered Member
|
I have the following unexpected 2X slow down, when I am using Eigen's column expression instead of manual looping through each element of the column. I am using clang on Mac with compile flags -O3 -DNDEBUG -march=native. I am using the latest trunk version of Eigen.
MethodA: 1.89s MethodB: 0.83s
The full code to reproduce the problem is https://gist.github.com/anonymous/29560512fb748bcbd706 |
Registered Member
|
I guess methodA is slower due to the vector resizing.
|
Registered Member
|
Hi Tienhung, what do you mean by resizing? |
Registered Member
|
in.col(j) and values.col(o) return column vectors, so their size must be verified before the addition and assignment. Eigen resizes values.col(o) on the left hand side. You can refer the link below for more information. http://eigen.tuxfamily.org/dox/group__TutorialMatrixClass.html |
Registered Member
|
I still don't understand why there should be resizing? Both values and in has same number of rows. Also since I am using non-debug mode, I expect no overhead of size check assertions. |
Registered Member
|
Hi,
Did you figure out why method 1 is more time consuming, and how do you optimize the code when assign one matrix to another? Thanks. |
Registered Member
|
When I compiled the same with gcc, the differences go away. So the problem is on Clang (I am on Mac OSX).
|
Registered users: Bing [Bot], Google [Bot], q.ignora, watchstar