forked from boostorg/smart_ptr
Added a timing test for the single/multi threaded perf ratio (~2:1)
[SVN r12821]
This commit is contained in:
23
shared_ptr_timing_test.cpp
Normal file
23
shared_ptr_timing_test.cpp
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
#include <boost/shared_ptr.hpp>
|
||||||
|
#include <iostream>
|
||||||
|
#include <vector>
|
||||||
|
#include <ctime>
|
||||||
|
|
||||||
|
int const n = 8 * 1024 * 1024;
|
||||||
|
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
std::vector< boost::shared_ptr<int> > v;
|
||||||
|
boost::shared_ptr<int> pi(new int);
|
||||||
|
|
||||||
|
std::clock_t t = std::clock();
|
||||||
|
|
||||||
|
for(int i = 0; i < n; ++i)
|
||||||
|
{
|
||||||
|
v.push_back(pi);
|
||||||
|
}
|
||||||
|
|
||||||
|
t = std::clock() - t;
|
||||||
|
|
||||||
|
std::cout << static_cast<double>(t) / CLOCKS_PER_SEC << '\n';
|
||||||
|
}
|
Reference in New Issue
Block a user