mirror of
https://github.com/boostorg/smart_ptr.git
synced 2026-02-03 22:05:04 +01:00
Moved smart_ptr contents to subdirectories, switched to a local test/Jamfile.
[SVN r17042]
This commit is contained in:
41
test/shared_ptr_timing_test.cpp
Normal file
41
test/shared_ptr_timing_test.cpp
Normal file
@@ -0,0 +1,41 @@
|
||||
#if defined(_MSC_VER) && !defined(__ICL) && !defined(__COMO__)
|
||||
#pragma warning(disable: 4786) // identifier truncated in debug info
|
||||
#pragma warning(disable: 4710) // function not inlined
|
||||
#pragma warning(disable: 4711) // function selected for automatic inline expansion
|
||||
#pragma warning(disable: 4514) // unreferenced inline removed
|
||||
#endif
|
||||
|
||||
//
|
||||
// shared_ptr_timing_test.cpp - use to evaluate the impact of thread safety
|
||||
//
|
||||
// Copyright (c) 2002 Peter Dimov and Multi Media Ltd.
|
||||
//
|
||||
// Permission to copy, use, modify, sell and distribute this software
|
||||
// is granted provided this copyright notice appears in all copies.
|
||||
// This software is provided "as is" without express or implied
|
||||
// warranty, and with no claim as to its suitability for any purpose.
|
||||
//
|
||||
|
||||
#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