Geo*_*rns 3 c++ performance boost visual-studio
我刚刚开始使用Boost 1.36.这些库在减少我正在处理的非托管C++软件项目中所需的代码量方面非常有用.
但是,当我尝试使用这些库时,我的编译时间增加了十倍.这几乎抵消了我使用该库所获得的生产力增益.
我正在使用3GHz Intel双核,2GB内存和VS 2003.
我添加了一段代码.
#include "boost/numeric/ublas/matrix.hpp" #include "boost/numeric/ublas/vector.hpp" #include "boost/numeric/ublas/matrix_proxy.hpp" typedef ublas::bounded_matrix <long double,NUM_OF_COLUMNS,NUM_OF_CATEGORIES,ublas::row_major> Matrix; typedef ublas::bounded_vector <long double,NUM_OF_COLUMNS> Vector;
void Print(const Matrix& amount)
{
Vector total;
total.clear();
for (int category = 0; category < NUM_OF_CATEGORIES; category++)
{
PrintLine(ublas::row(amount, category));
total += ublas::row(amount, category);
}
PrintLine(total);
Run Code Online (Sandbox Code Playgroud)
}
void Print(const Matrix& amount)
{
#include "boost/numeric/ublas/matrix.hpp"
#include "boost/numeric/ublas/vector.hpp"
#include "boost/numeric/ublas/matrix_proxy.hpp"
typedef ublas::bounded_matrix <long double,NUM_OF_COLUMNS,NUM_OF_CATEGORIES,ublas::row_major> Matrix;
typedef ublas::bounded_vector <long double,NUM_OF_COLUMNS> Vector;
}
void Print(const Matrix& amount)
{
Vector total;
total.clear();
for (int category = 0; category < NUM_OF_CATEGORIES; category++)
{
PrintLine(ublas::row(amount, category));
total += ublas::row(amount, category);
}
PrintLine(total);
Run Code Online (Sandbox Code Playgroud)
}
是VS 2003的问题吗?
我知道VS 2008更快,但升级将是一个艰难的卖点.
是不是Boost针对快速运行时间进行了优化而不是快速编译?
我只是以次优的方式使用Boost Library吗?
或者我只是使用错误的工具来完成工作?