Why use third-party vector libraries at all?

Posted by Patrick Powns on Stack Overflow See other posts from Stack Overflow or by Patrick Powns
Published on 2012-12-12T04:29:13Z Indexed on 2012/12/12 5:03 UTC
Read the original article Hit count: 229

Filed under:
|
|

So I'm thinking of using the Eigen matrix library for a project I'm doing (2D space simulator). I just went ahead and profiled some code with Eigen::Vector2d, and with bare arrays. I noticed a 10x improvement in assigning values to elements in the array, and a 40x improvement in calculating the dot products.

Here is my profiling if you want to check it out, basically it's ~4.065s against ~0.110s.

Obviously bare arrays are much more efficient at dot products and assigning stuff. So why use the Eigen library (or any other library, Eigen just seemed the fastest)? Is it stability? Complicated maths that would be hard to code by yourself efficiently?

© Stack Overflow or respective owner

Related posts about c++

Related posts about arrays