
Joaquin M Lopez Munoz
Stanislas RENAN
writes: Hi,
I've got a performance problem during a test I've done with multi_index on MSVC 6.0 SP 6. I'm using BOOST 1.32.0 . The search performance is comparable with several maps, but insertion is dramatically slow : 5mn 30s for 10 000 employees.
Here is my test code :
[...]
#if !defined(NDEBUG) #define BOOST_MULTI_INDEX_ENABLE_INVARIANT_CHECKING #define BOOST_MULTI_INDEX_ENABLE_SAFE_MODE #endif
I've taken a closer look at your program, and I think the comparison is not exactly fair. After populating your EmployeeMapper, their index sizes are: m_byId size:10000 m_byName size:10000 m_byAge size:100 while all indices of a multi_index_container have the same size (in this case, 10000). To balance this, I've changed employee e(i, // index numérique unique os.str(), // nom, chaîne unique alea(100)); // valeur potentiellement dupliquée to employee e(i, // index numérique unique os.str(), // nom, chaîne unique i); // unique and got the following results: Insertion multi = 47 STL = 78 Recherche multi = 234 STL = 266 If, instead of this change, I allow your EmployeeMapper to contain duplicate values for the age index by turning m_byAge into a multimap (and doing the necessary changes, vg. multimap does not have an operator[]) the numbers are: Insertion multi = 62 STL = 94 Recherche multi = 297 STL = 312 Joaquín M López Muñoz Telefónica, Investigación y Desarrollo