Code:
void test()
{
clock_t t1 = clock();
std::multiset<int> set;
for (int i = 0; i < 1000000; ++i)
set.insert(i);
clock_t t2 = clock();
cout << "time: " << t2 - t1 << "ms" << endl;
}
on my machine, with optimizations turned on, an e8400 overclocked to 3.6ghz that takes 1357ms to do all the insertions. the time for the function to exit is 105813ms, which means it's taking 104456ms for the destructor of the multiset to run.
i'm not sure why it's so slow....even if you remove every item 1 by 1 it should still be O(n log n) right? same as insertion?
is there a way where i can make the cleanup faster?
thanks.