Registered Member
|
I was benchmarking the difference between a basic if statement and replace and eigen select and eigen select takes almost 1.5 times as long. How can this be?
Here is my code
and the output (these values are representative, I've run it and averaged over 30 trials to be sure)
Running on an i7 920, visual studio 2010, 64 bit, all optimization enabled in release mode. Code is Eigen trunk rev. 4166 Eigen is always soooo much faster than the code I write myself -- I feel like I must be forgetting something given the simple case. As the threshold changes and the total operation time rises due to the two different branching proportions, the ratio between mine and eigen stays almost perfectly at ~1.5 |
Moderator
|
this is probably because the equivalent code is:
for( int i=0; i<m_filteredResult.size(); i++ ) { m_filteredResult(i) = (columnSums.coeff(i) < theQualityFilterThreshold) ? 0.0f : m_filteredResult(i); } and MSVC is perhaps not able to simplify this because of all the abstraction layer. Checking the generated assembly would help to see what's going on. |
Registered users: bartoloni, Bing [Bot], Google [Bot], Yahoo [Bot]