From 875bab352c9582f8699591a55cc7c2e479e4ba0c Mon Sep 17 00:00:00 2001 From: Peter Dimov Date: Fri, 15 Feb 2002 18:06:17 +0000 Subject: [PATCH] Added a timing test for the single/multi threaded perf ratio (~2:1) [SVN r12821] --- shared_ptr_timing_test.cpp | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 shared_ptr_timing_test.cpp diff --git a/shared_ptr_timing_test.cpp b/shared_ptr_timing_test.cpp new file mode 100644 index 0000000..d456eaf --- /dev/null +++ b/shared_ptr_timing_test.cpp @@ -0,0 +1,23 @@ +#include +#include +#include +#include + +int const n = 8 * 1024 * 1024; + +int main() +{ + std::vector< boost::shared_ptr > v; + boost::shared_ptr 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(t) / CLOCKS_PER_SEC << '\n'; +}