RCP_Performance_UnitTests.cpp

Go to the documentation of this file.
00001 #include "Teuchos_UnitTestHarness.hpp"
00002 #include "Teuchos_RCP.hpp"
00003 #include "Teuchos_TabularOutputter.hpp"
00004 
00005 #ifdef HAVE_TEUCHOS_BOOST
00006 #  include "boost/shared_ptr.hpp"
00007 #endif
00008 
00009 
00010 namespace {
00011 
00012 
00013 using Teuchos::null;
00014 using Teuchos::RCP;
00015 using Teuchos::rcp;
00016 using Teuchos::TabularOutputter;
00017 
00018 
00019 double relCpuSpeed = 1e-2;
00020 int maxArraySize = 10000;
00021 double maxRcpRawCreateDestroyRatio = 10.0;
00022 double maxRcpRawAdjustRefCountRatio = 100.0;
00023 double maxRcpSpAdjustRefCountRatio = 5.0;
00024 double maxRcpRawObjAccessRatio = 10.0;
00025 
00026 const int intPrec = 8;
00027 const int dblPrec = 6;
00028 
00029 
00030 TEUCHOS_STATIC_SETUP()
00031 {
00032   Teuchos::CommandLineProcessor &clp =
00033     Teuchos::UnitTestRepository::getCLP();
00034   clp.setOption(
00035     "rel-cpu-speed", &relCpuSpeed,
00036     "The relative speed of the CPU (higher means the machine runs faster)"
00037     );
00038   clp.setOption(
00039     "max-array-size", &maxArraySize,
00040     "The maximum size of the arrays created"
00041     );
00042   clp.setOption(
00043     "max-rcp-create-destroy-ratio", &maxRcpRawCreateDestroyRatio,
00044     "The ratio of the final CPU time ratio of creating and destroying"
00045     "std::vector<char>(size) objects wrapped in an RCP object versus"
00046     "using just raw new and delete."
00047     );
00048   clp.setOption(
00049     "max-rcp-raw-adjust-ref-count-ratio", &maxRcpRawAdjustRefCountRatio,
00050     "The ratio of the final CPU time ratio for adjusting the reference"
00051     "count of RCP objects versus a raw pointer."
00052     );
00053   clp.setOption(
00054     "max-rcp-sp-adjust-ref-count-ratio", &maxRcpSpAdjustRefCountRatio,
00055     "The ratio of the final CPU time ratio for adjusting the reference"
00056     "count of RCP objects versus boost::shared_ptr objects."
00057     );
00058   clp.setOption(
00059     "max-rcp-raw-obj-access-ratio", &maxRcpRawObjAccessRatio,
00060     "The ratio of the final CPU time ratio for accessing the object for RCP"
00061     "versus a raw pointer."
00062     );
00063 
00064 }
00065 
00066 
00067 template<typename T>
00068 struct DeleteDeleter {};
00069 
00070 
00071 TEUCHOS_UNIT_TEST( RCP, _sizeofObjects )
00072 {
00073   out << "\nPrinting the size the RCP and RCPNodeImpl objects ...\n";
00074   TEST_INEQUALITY_CONST(sizeof(bool), 0);
00075   TEST_INEQUALITY_CONST(sizeof(double), 0);
00076   TEST_INEQUALITY_CONST(sizeof(double*), 0);
00077   TEST_INEQUALITY_CONST(sizeof(std::vector<double>), 0);
00078   TEST_INEQUALITY_CONST(sizeof(Teuchos::RCPNode*), 0);
00079   TEST_INEQUALITY_CONST(sizeof(Teuchos::ERCPStrength), 0);
00080   TEST_INEQUALITY_CONST(sizeof(Teuchos::RCPNodeHandle), 0);
00081   TEST_INEQUALITY_CONST(sizeof(Teuchos::RCP<std::vector<double> >), 0);
00082   TEST_INEQUALITY_CONST(
00083     sizeof(Teuchos::RCPNodeTmpl<std::vector<double>,
00084       Teuchos::DeallocDelete<std::vector<double> > >),
00085     0);
00086 #ifdef HAVE_TEUCHOS_BOOST
00087   TEST_INEQUALITY_CONST(sizeof(boost::detail::shared_count), 0);
00088   TEST_INEQUALITY_CONST(sizeof(boost::shared_ptr<std::vector<double> >), 0);
00089   TEST_INEQUALITY_CONST(sizeof(boost::detail::sp_counted_impl_p<std::vector<double> >), 0);
00090   TEST_INEQUALITY_CONST(
00091     sizeof(boost::detail::sp_counted_impl_pd<std::vector<double>,
00092       DeleteDeleter<std::vector<double> > >),
00093     0);
00094 #endif
00095 }
00096 
00097 
00098 TEUCHOS_UNIT_TEST( RCP, createDestroyOverhead )
00099 {
00100 
00101   typedef Teuchos::TabularOutputter TO;
00102 
00103   const int maxLoopIters = 1000;
00104   const double relTestCost = 1e-3;
00105   const double numInnerLoops = relCpuSpeed / relTestCost;
00106 
00107   out << "\n"
00108       << "Messuring the overhead of creating and destorying objects of different sizes\n"
00109       << "using raw C++ pointers, shared_ptr, and using RCP.\n"
00110       << "\n"
00111       << "Number of loops = relCpuSpeed/relTestCost = "
00112       << relCpuSpeed << "/" << relTestCost << " = " << numInnerLoops << "\n"
00113       << "\n";
00114 
00115   TabularOutputter outputter(out);
00116   outputter.setFieldTypePrecision(TO::DOUBLE, dblPrec);
00117   outputter.setFieldTypePrecision(TO::INT, intPrec);
00118 
00119   outputter.pushFieldSpec("obj size", TO::INT);
00120   outputter.pushFieldSpec("num loops", TO::INT);
00121   outputter.pushFieldSpec("raw", TO::DOUBLE);
00122 #ifdef HAVE_TEUCHOS_BOOST
00123   outputter.pushFieldSpec("shared_ptr", TO::DOUBLE);
00124 #endif
00125   outputter.pushFieldSpec("RCP", TO::DOUBLE);
00126 #ifdef HAVE_TEUCHOS_BOOST
00127   outputter.pushFieldSpec("shared_ptr/raw", TO::DOUBLE);
00128 #endif
00129   outputter.pushFieldSpec("RCP/raw", TO::DOUBLE);
00130 
00131   outputter.outputHeader();
00132 
00133   double finalRcpRawRatio = 100000.0;
00134 
00135   int arraySize = 1;
00136   for (int test_case_k = 0;
00137     test_case_k < maxLoopIters && arraySize <= maxArraySize;
00138     ++test_case_k
00139     )
00140   {
00141 
00142     // obj size
00143     outputter.outputField(arraySize);
00144 
00145     // num loops
00146     const int numActualLoops =
00147       TEUCHOS_MAX(
00148         static_cast<int>(
00149           (numInnerLoops / arraySize)
00150           * std::log(static_cast<double>(arraySize+1))
00151           ),
00152         1
00153         );
00154     outputter.outputField(numActualLoops);
00155 
00156     // raw
00157     {
00158       std::vector<std::vector<char>*> p_raw_vec(numActualLoops);
00159       int i = 0;
00160       TEUCHOS_START_PERF_OUTPUT_TIMER(outputter, numActualLoops)
00161       {
00162         p_raw_vec[i] = new std::vector<char>(arraySize, 1);
00163         delete p_raw_vec[i];
00164         ++i;
00165       }
00166     }
00167     TEUCHOS_END_PERF_OUTPUT_TIMER(outputter, rawPtrTime);
00168     
00169 #ifdef HAVE_TEUCHOS_BOOST
00170     // shared_ptr
00171     {
00172       typedef boost::shared_ptr<std::vector<char> > shared_ptr_t;
00173       std::vector<shared_ptr_t > sp_vec(numActualLoops);
00174       int i = 0;
00175       TEUCHOS_START_PERF_OUTPUT_TIMER(outputter, numActualLoops)
00176       {
00177         sp_vec[i] = shared_ptr_t(new std::vector<char>(arraySize, 1));
00178         sp_vec[i].reset();
00179         ++i;
00180       }
00181     }
00182     TEUCHOS_END_PERF_OUTPUT_TIMER(outputter, spTime);
00183 #endif
00184 
00185     // RCP
00186     {
00187       std::vector<RCP<std::vector<char> > > p_vec(numActualLoops);
00188       int i = 0;
00189       TEUCHOS_START_PERF_OUTPUT_TIMER(outputter, numActualLoops)
00190       {
00191         p_vec[i] = rcp(new std::vector<char>(arraySize, 1));
00192         p_vec[i] = null;
00193       }
00194     }
00195     TEUCHOS_END_PERF_OUTPUT_TIMER(outputter, rcpTime);
00196 
00197 #ifdef HAVE_TEUCHOS_BOOST
00198     // shared_ptr/rawPtr
00199     const double spRatio = spTime / rawPtrTime;
00200     outputter.outputField(spRatio);
00201 #endif
00202 
00203     // RCP/rawPtr
00204     const double rcpRatio = rcpTime / rawPtrTime;
00205     outputter.outputField(rcpRatio);
00206 
00207     outputter.nextRow();
00208     
00209     arraySize *= 4;
00210     finalRcpRawRatio = TEUCHOS_MIN(rcpRatio, finalRcpRawRatio);
00211 
00212   }
00213 
00214   out << "\n";
00215   TEST_COMPARE( finalRcpRawRatio, <=, maxRcpRawCreateDestroyRatio );
00216   out << "\n";
00217 
00218 }
00219 
00220 
00221 TEUCHOS_UNIT_TEST( RCP, referenceCountManipulationOverhead )
00222 {
00223 
00224   typedef Teuchos::TabularOutputter TO;
00225 
00226   const double relTestCost = 5e-3;
00227   const int maxLoopIters = 1000;
00228   const double numInnerLoops = relCpuSpeed / relTestCost;
00229 
00230   out << "\n"
00231       << "Messuring the overhead of incrementing and deincrementing the reference count\n"
00232       << "comparing RCP to raw pointer and boost::shared_ptr.\n"
00233       << "\n";
00234 
00235   TabularOutputter outputter(out);
00236   outputter.setFieldTypePrecision(TO::DOUBLE, dblPrec);
00237   outputter.setFieldTypePrecision(TO::INT, intPrec);
00238 
00239   outputter.pushFieldSpec("array dim", TO::INT);
00240   outputter.pushFieldSpec("num loops", TO::INT);
00241   outputter.pushFieldSpec("raw", TO::DOUBLE);
00242   outputter.pushFieldSpec("shared_ptr", TO::DOUBLE);
00243   outputter.pushFieldSpec("RCP", TO::DOUBLE);
00244   outputter.pushFieldSpec("RCP/raw", TO::DOUBLE);
00245   outputter.pushFieldSpec("RCP/shared_ptr", TO::DOUBLE);
00246 
00247   outputter.outputHeader();
00248 
00249   double finalRcpRawRatio = 100000.0;
00250   double finalRcpSpRatio = 100000.0;
00251   int arraySize = 64;
00252 
00253   for (
00254     int test_case_k = 0;
00255     test_case_k < maxLoopIters && arraySize <= maxArraySize;
00256     ++test_case_k
00257     )
00258   {
00259 
00260     // array dim
00261     outputter.outputField(arraySize);
00262 
00263     // num loops
00264     const int numActualLoops =
00265       TEUCHOS_MAX(
00266         static_cast<int>(
00267           (numInnerLoops / arraySize)
00268           * std::log(static_cast<double>(arraySize+1))
00269           ),
00270         1
00271         );
00272     outputter.outputField(numActualLoops);
00273 
00274     // raw
00275     {
00276       char dummy_char = 'n';
00277       std::vector<char*> p_raw_vec(arraySize);
00278       TEUCHOS_START_PERF_OUTPUT_TIMER_INNERLOOP(outputter, numActualLoops, arraySize)
00279       {
00280         for (int i=0; i < arraySize; ++i) {
00281           p_raw_vec[i] = &dummy_char;
00282         }
00283       }
00284     }
00285     TEUCHOS_END_PERF_OUTPUT_TIMER(outputter, rawPtrTime);
00286     
00287 #ifdef HAVE_TEUCHOS_BOOST
00288     // shared_ptr
00289     {
00290       typedef boost::shared_ptr<char> shared_ptr_t;
00291       shared_ptr_t sp(new char('n'));
00292       std::vector<shared_ptr_t> sp_vec(arraySize);
00293       TEUCHOS_START_PERF_OUTPUT_TIMER_INNERLOOP(outputter, numActualLoops, arraySize)
00294       {
00295         for (int i=0; i < arraySize; ++i) {
00296           sp_vec[i] = sp;
00297         }
00298       }
00299     }
00300     TEUCHOS_END_PERF_OUTPUT_TIMER(outputter, spTime);
00301 #else
00302     outputter.outputField("-");
00303 #endif
00304 
00305     // RCP
00306     {
00307       RCP<char> p(new char('n'));
00308       std::vector<RCP<char> > p_vec(arraySize);
00309       TEUCHOS_START_PERF_OUTPUT_TIMER_INNERLOOP(outputter, numActualLoops, arraySize)
00310       {
00311         for (int i=0; i < arraySize; ++i) {
00312           p_vec[i] = p;
00313           // NOTE: This assignment operation tests the copy constructor and
00314           // the swap function.  This calls both bind() and unbind()
00315           // underneath.
00316         }
00317       }
00318     }
00319     TEUCHOS_END_PERF_OUTPUT_TIMER(outputter, rcpTime);
00320 
00321     // RCP/raw
00322     const double rcpRawRatio = rcpTime / rawPtrTime;
00323     finalRcpRawRatio = TEUCHOS_MIN(rcpRawRatio, finalRcpRawRatio);
00324     outputter.outputField(rcpRawRatio);
00325 
00326 #ifdef HAVE_TEUCHOS_BOOST
00327     // RCP/shared_ptr
00328     const double rcpSpRatio = rcpTime / spTime;
00329     finalRcpSpRatio = TEUCHOS_MIN(rcpSpRatio, finalRcpSpRatio);
00330     outputter.outputField(rcpSpRatio);
00331 #else
00332     outputter.outputField("-");
00333 #endif
00334 
00335     outputter.nextRow();
00336     
00337     arraySize *= 4;
00338 
00339   }
00340 
00341   out << "\n";
00342   TEST_COMPARE( finalRcpRawRatio, <=, maxRcpRawAdjustRefCountRatio );
00343 #ifdef HAVE_TEUCHOS_BOOST
00344   out << "\n";
00345   TEST_COMPARE( finalRcpSpRatio, <=, maxRcpSpAdjustRefCountRatio );
00346   out << "\n";
00347 #else
00348   (void)finalRcpSpRatio;
00349 #endif
00350   
00351 }
00352 
00353 
00354 TEUCHOS_UNIT_TEST( RCP, dereferenceOverhead )
00355 {
00356 
00357   typedef Teuchos::TabularOutputter TO;
00358 
00359   const double relTestCost = 1e-4;
00360   const int maxLoopIters = 1000;
00361   const double numInnerLoops = relCpuSpeed / relTestCost;
00362 
00363   out << "\n"
00364       << "Messuring the overhead of dereferencing RCP, shared_ptr and a raw pointer.\n"
00365       << "\n";
00366 
00367   TabularOutputter outputter(out);
00368   outputter.setFieldTypePrecision(TO::DOUBLE, dblPrec);
00369   outputter.setFieldTypePrecision(TO::INT, intPrec);
00370 
00371   outputter.pushFieldSpec("array dim", TO::INT);
00372   outputter.pushFieldSpec("num loops", TO::INT);
00373   outputter.pushFieldSpec("raw", TO::DOUBLE);
00374   outputter.pushFieldSpec("shared_ptr", TO::DOUBLE);
00375   outputter.pushFieldSpec("RCP", TO::DOUBLE);
00376   outputter.pushFieldSpec("RCP/raw", TO::DOUBLE);
00377   outputter.pushFieldSpec("RCP/shared_ptr", TO::DOUBLE);
00378 
00379   outputter.outputHeader();
00380 
00381   double finalRcpRawRatio = 100000.0;
00382   int arraySize = 64;
00383   const int dummy_int_val = 1;
00384   int overall_dummy_int_out = 0;
00385   
00386 
00387   for (
00388     int test_case_k = 0;
00389     test_case_k < maxLoopIters && arraySize <= maxArraySize;
00390     ++test_case_k
00391     )
00392   {
00393 
00394     // array dim
00395     outputter.outputField(arraySize);
00396 
00397     // num loops
00398     const int numActualLoops =
00399       TEUCHOS_MAX(
00400         static_cast<int>(
00401           (numInnerLoops / arraySize)
00402           * std::log(static_cast<double>(arraySize+1))
00403           ),
00404         1
00405         );
00406     outputter.outputField(numActualLoops);
00407 
00408     int dummy_int_out = 0;
00409 
00410     // raw
00411     {
00412       int dummy_int = dummy_int_val;
00413       std::vector<int*> p_raw_vec(arraySize);
00414       for (int i=0; i < arraySize; ++i) {
00415         p_raw_vec[i] = &dummy_int;
00416       }
00417       dummy_int_out = 0;
00418       TEUCHOS_START_PERF_OUTPUT_TIMER_INNERLOOP(outputter, numActualLoops, arraySize)
00419       {
00420         for (int i=0; i < arraySize; ++i) {
00421           dummy_int_out += *p_raw_vec[i];
00422         }
00423       }
00424     }
00425     TEUCHOS_END_PERF_OUTPUT_TIMER(outputter, rawPtrTime);
00426     overall_dummy_int_out += dummy_int_out;
00427     
00428     // shared_ptr
00429 #ifdef HAVE_TEUCHOS_BOOST
00430     {
00431       typedef boost::shared_ptr<int> shared_ptr_t;
00432       shared_ptr_t sp(new int(dummy_int_val));
00433       std::vector<shared_ptr_t> sp_vec(arraySize);
00434       for (int i=0; i < arraySize; ++i) {
00435         sp_vec[i] = sp;
00436       }
00437       dummy_int_out = 0;
00438       TEUCHOS_START_PERF_OUTPUT_TIMER_INNERLOOP(outputter, numActualLoops, arraySize)
00439       {
00440         for (int i=0; i < arraySize; ++i) {
00441           dummy_int_out += *sp_vec[i];
00442         }
00443       }
00444     }
00445     TEUCHOS_END_PERF_OUTPUT_TIMER(outputter, spTime);
00446     overall_dummy_int_out += dummy_int_out;
00447 #else
00448     outputter.outputField("-");
00449 #endif
00450 
00451     // RCP
00452     {
00453       RCP<int> p(new int(dummy_int_val));
00454       std::vector<RCP<int> > p_vec(arraySize);
00455       for (int i=0; i < arraySize; ++i) {
00456         p_vec[i] = p;
00457       }
00458       dummy_int_out = 0;
00459       TEUCHOS_START_PERF_OUTPUT_TIMER_INNERLOOP(outputter, numActualLoops, arraySize)
00460       {
00461         for (int i=0; i < arraySize; ++i) {
00462           dummy_int_out += *p_vec[i];
00463         }
00464       }
00465     }
00466     TEUCHOS_END_PERF_OUTPUT_TIMER(outputter, rcpTime);
00467     overall_dummy_int_out += dummy_int_out;
00468 
00469     // RCP/raw
00470     const double rcpRawRatio = rcpTime / rawPtrTime;
00471     finalRcpRawRatio = TEUCHOS_MIN(rcpRawRatio, finalRcpRawRatio);
00472     outputter.outputField(rcpRawRatio);
00473 
00474 #ifdef HAVE_TEUCHOS_BOOST
00475     // RCP/shared_ptr
00476     const double rcpSpRatio = rcpTime / spTime;
00477     outputter.outputField(rcpSpRatio);
00478 #else
00479     outputter.outputField("-");
00480 #endif
00481 
00482     outputter.nextRow();
00483     
00484     arraySize *= 4;
00485 
00486   }
00487 
00488   out << "\n";
00489   TEST_COMPARE( finalRcpRawRatio, <=, maxRcpRawObjAccessRatio );
00490   out << "\n";
00491 
00492   // This silly varible must be accumulated or compilers like MSVC++ will
00493   // optimize away the loops!
00494   if (overall_dummy_int_out == 0)
00495     success = false;
00496   
00497 }
00498 
00499 
00500 struct SomeStruct {
00501   SomeStruct(int member_in) : member(member_in) {}
00502   int member;
00503 };
00504 
00505 
00506 TEUCHOS_UNIT_TEST( RCP, memberAccessOverhead )
00507 {
00508 
00509   typedef Teuchos::TabularOutputter TO;
00510 
00511   const double relTestCost = 1e-4;
00512   const int maxLoopIters = 1000;
00513   const double numInnerLoops = relCpuSpeed / relTestCost;
00514 
00515   out << "\n"
00516       << "Messuring the overhead of dereferencing RCP, shared_ptr and a raw pointer.\n"
00517       << "\n";
00518 
00519   TabularOutputter outputter(out);
00520   outputter.setFieldTypePrecision(TO::DOUBLE, dblPrec);
00521   outputter.setFieldTypePrecision(TO::INT, intPrec);
00522 
00523   outputter.pushFieldSpec("array dim", TO::INT);
00524   outputter.pushFieldSpec("num loops", TO::INT);
00525   outputter.pushFieldSpec("raw", TO::DOUBLE);
00526   outputter.pushFieldSpec("shared_ptr", TO::DOUBLE);
00527   outputter.pushFieldSpec("RCP", TO::DOUBLE);
00528   outputter.pushFieldSpec("RCP/raw", TO::DOUBLE);
00529   outputter.pushFieldSpec("RCP/shared_ptr", TO::DOUBLE);
00530 
00531   outputter.outputHeader();
00532 
00533   double finalRcpRawRatio = 100000.0;
00534   int arraySize = 64;
00535   const int dummy_int_val = 1;
00536   int overall_dummy_int_out = 0;
00537 
00538   for (
00539     int test_case_k = 0;
00540     test_case_k < maxLoopIters && arraySize <= maxArraySize;
00541     ++test_case_k
00542     )
00543   {
00544 
00545     // array dim
00546     outputter.outputField(arraySize);
00547 
00548     // num loops
00549     const int numActualLoops =
00550       TEUCHOS_MAX(
00551         static_cast<int>(
00552           (numInnerLoops / arraySize)
00553           * std::log(static_cast<double>(arraySize+1))
00554           ),
00555         1
00556         );
00557     outputter.outputField(numActualLoops);
00558 
00559     int dummy_int_out = 0;
00560 
00561     // raw
00562     {
00563       SomeStruct dummy_SomeStruct(dummy_int_val);
00564       std::vector<SomeStruct*> p_raw_vec(arraySize);
00565       for (int i=0; i < arraySize; ++i) {
00566         p_raw_vec[i] = &dummy_SomeStruct;
00567       }
00568       dummy_int_out = 0;
00569       TEUCHOS_START_PERF_OUTPUT_TIMER_INNERLOOP(outputter, numActualLoops, arraySize)
00570       {
00571         for (int i=0; i < arraySize; ++i) {
00572           dummy_int_out += p_raw_vec[i]->member;
00573         }
00574       }
00575     }
00576     TEUCHOS_END_PERF_OUTPUT_TIMER(outputter, rawPtrTime);
00577     overall_dummy_int_out += dummy_int_out;
00578     
00579     // shared_ptr
00580 #ifdef HAVE_TEUCHOS_BOOST
00581     {
00582       typedef boost::shared_ptr<SomeStruct> shared_ptr_t;
00583       shared_ptr_t sp(new SomeStruct(dummy_int_val));
00584       std::vector<shared_ptr_t> sp_vec(arraySize);
00585       for (int i=0; i < arraySize; ++i) {
00586         sp_vec[i] = sp;
00587       }
00588       dummy_int_out = 0;
00589       TEUCHOS_START_PERF_OUTPUT_TIMER_INNERLOOP(outputter, numActualLoops, arraySize)
00590       {
00591         for (int i=0; i < arraySize; ++i) {
00592           dummy_int_out += sp_vec[i]->member;
00593         }
00594       }
00595     }
00596     TEUCHOS_END_PERF_OUTPUT_TIMER(outputter, spTime);
00597     overall_dummy_int_out += dummy_int_out;
00598 #else
00599     outputter.outputField("-");
00600 #endif
00601 
00602     // RCP
00603     {
00604       RCP<SomeStruct> p(new SomeStruct(dummy_int_val));
00605       std::vector<RCP<SomeStruct> > p_vec(arraySize);
00606       for (int i=0; i < arraySize; ++i) {
00607         p_vec[i] = p;
00608       }
00609       dummy_int_out = 0;
00610       TEUCHOS_START_PERF_OUTPUT_TIMER_INNERLOOP(outputter, numActualLoops, arraySize)
00611       {
00612         for (int i=0; i < arraySize; ++i) {
00613           dummy_int_out += p_vec[i]->member;
00614         }
00615       }
00616     }
00617     TEUCHOS_END_PERF_OUTPUT_TIMER(outputter, rcpTime);
00618     overall_dummy_int_out += dummy_int_out;
00619 
00620     // RCP/raw
00621     const double rcpRawRatio = rcpTime / rawPtrTime;
00622     finalRcpRawRatio = TEUCHOS_MIN(rcpRawRatio, finalRcpRawRatio);
00623     outputter.outputField(rcpRawRatio);
00624 
00625 #ifdef HAVE_TEUCHOS_BOOST
00626     // RCP/shared_ptr
00627     const double rcpSpRatio = rcpTime / spTime;
00628     outputter.outputField(rcpSpRatio);
00629 #else
00630     outputter.outputField("-");
00631 #endif
00632 
00633     outputter.nextRow();
00634     
00635     arraySize *= 4;
00636 
00637   }
00638 
00639   out << "\n";
00640   TEST_COMPARE( finalRcpRawRatio, <=, maxRcpRawObjAccessRatio );
00641   out << "\n";
00642 
00643   // This silly varible must be accumulated or compilers like MSVC++ will
00644   // optimize away the loops!
00645   if (overall_dummy_int_out == 0)
00646     success = false;
00647   
00648 }
00649 
00650 
00651 
00652 
00653 
00654 
00655 
00656 } // namespace
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
Generated on Wed Apr 13 09:57:28 2011 for Teuchos Package Browser (Single Doxygen Collection) by  doxygen 1.6.3