id summary reporter owner description type status milestone component version severity resolution keywords cc 3518 got terible performace to use multi_index david.joe Joaquín M López Muñoz "hi, first of all,multi_index is a good idea. when i test it. i got a very bad performance. on the simplest condition,it takes 1.5 ms to 15ms to insert a element. it is too slower than many db,etc sqlite (0.031ms). the code is listed below: // testMultiIndex2.cpp : main project file. #include ""stdafx.h"" #if !defined(NDEBUG) #define BOOST_MULTI_INDEX_ENABLE_INVARIANT_CHECKING #define BOOST_MULTI_INDEX_ENABLE_SAFE_MODE #endif #include #include #include #include #include #include #include #include #include ""..\..\..\..\..\src\common_cpp\tchar_ex.h"" #include ""..\..\..\..\..\src\common_cpp2\TsCommonCpp2\TsCommonCpp2\RecTime.h"" #include ""..\..\..\..\..\trunk\src\common_cpp\StrDigEtc.h"" using boost::multi_index_container; using namespace boost::multi_index; using namespace std; using namespace System; using namespace dbset; class employee { public: //employee() //{} employee(int id_,_tstring name_,int age_):id(id_),name(name_),age(age_){} public: int id; _tstring name; int age; friend _tostream& operator<<(_tostream& os,const employee& e) { os<, BOOST_MULTI_INDEX_MEMBER(employee,int,id)> //, // ordered_non_unique< // tag,BOOST_MULTI_INDEX_MEMBER(employee,_tstring,name)>, // ordered_non_unique< // tag, BOOST_MULTI_INDEX_MEMBER(employee,int,age)> > > employee_set; template void print_out_by( const MultiIndexContainer& s, Tag* =0 /* fixes a MSVC++ 6.0 bug with implicit template function parms */ ) { /* obtain a reference to the index tagged by Tag */ const typename boost::multi_index::index::type& i= get(s); typedef typename MultiIndexContainer::value_type value_type; /* dump the elements of the index to cout */ std::copy(i.begin(),i.end(),std::ostream_iterator(std::cout)); } int main(array ^args) { Console::WriteLine(L""start ...""); CRecTime rectimer; rectimer.setStart(); employee_set es; int max; rectimer.setStart(); max = 10; //max = 1000; //max = 1000 * 10; _tstring name; for(int i = 0, j=max; i < max; i ++,j--) { name = _T(""Albert-""); name += StrDigEtc::itoa(i); es.insert(employee(i,name,j)); } rectimer.setStop(); _tcout << _T(""exec time is : "") << rectimer.getTimePassed() << endl; _tcout << _T(""perline consume time is : "") << double(rectimer.getTimePassedNano()) / (double) max << endl; Console::WriteLine(L""end ...""); return 0; } " Bugs closed Boost 1.41.0 multi_index Boost 1.40.0 Problem invalid