This forum has been archived. All content is frozen. Please use KDE Discuss instead.

Speed issue in assignment to Eigen

Tags: None
(comma "," separated)
coolcat
Registered Member
Posts
20
Karma
0
OS

Speed issue in assignment to Eigen

Sat Nov 30, 2013 10:45 am
Hi,
I really appreciate Eigen and your effor very much.

Recently, when I tested hard realtime control application using Eigen, I found out something which I think is very strange.
(Just for your information, the compil;er is MS Visual Studio 2010 running RTX2012 on MS Windows 7)
The speed of assigning the vector elements is much slower when I use, e.g.
q << 1.0, 0.1, 2.5, ......;
for the (statically assigned) vector. e.g.
Eigen::Matrix<double, 16, 1> q;
This is very trivial assignment so I didn't think the bottleneck of realtime computation happened there.
But, in debugging the code, it is really slow.
So, I changed the code to
q[0] = 1.0;
q[1] = 0.1;
...
Then, I gained realtime performance.

What is the difference? Is there any other options to accelerate the speed?

Then, shouldn't I use such assignement operation in hard realtime computation?
I love this assignment operation very much.
User avatar
ggael
Moderator
Posts
3447
Karma
19
OS
In debug mode this operator add a significant overhead. With optimization ON, both methods produces very similar ASM and performance, at least with gcc. Perhaps MSVC still fails to inline a few functions. Looking at the generate ASM should help fixing the issue by forcing inlining of the problematic function. But first make sure you benchmarked in release mode.
coolcat
Registered Member
Posts
20
Karma
0
OS
Thanks.
First let me follow your hint, and if I get some result, I'll post again.


Bookmarks



Who is online

Registered users: Bing [Bot], Google [Bot], Yahoo [Bot]