
Rene Rivera wrote:
No.. just one that tests all three of the functions. The timing test you have only tests one of them.
No, it tests two of them. The push_back loop causes vector reallocations that copy and destroy the old contents. But increments are more frequent. If you put a v.resize( 0 ) after the loop, it will test an even number of increments and decrements but will also time 2^23 int destructions and this will skew the results. Your std::fill idea with an empty pointer isn't bad, though. lock() should be tested in a weak_ptr_timing_test, but I haven't written one yet.
Well certainly an _mt timing test would be best. As it's not that useful to only time the non-contention cases.
There are two _mt tests that are also timing tests, you even reported crashes with one of them. ;-) The intent of shared_ptr_timing_test is precisely to time the uncontended case, because that's what I want to measure, the cost of MT safety when none is needed.