//purpose :
//=======================================================================
template<class CollectionType, class StlType>
-void TestPerformanceRandomIterator()
+void TestPerformanceRandomIterator(Draw_Interpretor& di)
{
OSD_Timer aTimer;
Standard_Real aOccTime = aTimer.ElapsedTime();
- std::cout << aSize << "\t" << aStlTime << "\t" <<
- aOccTime << "\t" << aOccTime / aStlTime << std::endl;
+ di << aSize << "\t" << aStlTime << "\t" <<
+ aOccTime << "\t" << aOccTime / aStlTime << "\n";
// check that result is the same
if ( ! std::equal (aVector->begin(), aVector->end(), aCollec->begin()) )
- std::cout << "Error: sequences are not the same at the end!" << std::endl;
+ di << "Error: sequences are not the same at the end!" << "\n";
delete aVector;
delete aCollec;
//purpose :
//=======================================================================
template<class CollectionType, class StlType>
-void TestPerformanceForwardIterator()
+void TestPerformanceForwardIterator(Draw_Interpretor& di)
{
OSD_Timer aTimer;
Standard_Real aOccTime = aTimer.ElapsedTime();
- std::cout << aSize << "\t" << aStlTime << "\t" <<
- aOccTime << "\t" << aOccTime / aStlTime << std::endl;
+ di << aSize << "\t" << aStlTime << "\t" <<
+ aOccTime << "\t" << aOccTime / aStlTime << "\n";
// check that result is the same
if ( ! std::equal (aVector->begin(), aVector->end(), aCollec->begin()) )
- std::cout << "Error: sequences are not the same at the end!" << std::endl;
+ di << "Error: sequences are not the same at the end!" << "\n";
delete aVector;
delete aCollec;
//purpose :
//=======================================================================
template<class CollectionType, class StlType>
-void TestPerformanceBidirIterator()
+void TestPerformanceBidirIterator(Draw_Interpretor& di)
{
OSD_Timer aTimer;
Standard_Real aOccTime = aTimer.ElapsedTime();
- std::cout << aSize << "\t" << aStlTime << "\t" <<
- aOccTime << "\t" << aOccTime / aStlTime << std::endl;
+ di << aSize << "\t" << aStlTime << "\t" <<
+ aOccTime << "\t" << aOccTime / aStlTime << "\n";
// check that result is the same
if ( ! std::equal (aVector->begin(), aVector->end(), aCollec->begin()) )
- std::cout << "Error: sequences are not the same at the end!" << std::endl;
+ di << "Error: sequences are not the same at the end!" << "\n";
delete aVector;
delete aCollec;
//purpose :
//=======================================================================
template<class CollectionType, class T>
-void TestPerformanceMapAccess()
+void TestPerformanceMapAccess(Draw_Interpretor& di)
{
OSD_Timer aTimer;
if (aResult)
{
- std::cout << aSize << "\t" << aStlTime << "\t" <<
- aOccTime << "\t" << (aStlTime > 1e-16 ? aOccTime / aStlTime : -1) << std::endl;
+ di << aSize << "\t" << aStlTime << "\t" <<
+ aOccTime << "\t" << (aStlTime > 1e-16 ? aOccTime / aStlTime : -1) << "\n";
}
delete aCollec;
//function : QANTestNCollectionPerformance
//purpose :
//=======================================================================
-static Standard_Integer QANTestNCollectionPerformance (
- Draw_Interpretor& /*theInterpretor*/, Standard_Integer, const char**)
+static Standard_Integer QANTestNCollectionPerformance (Draw_Interpretor& di, Standard_Integer, const char**)
{
- std::cout.precision (8);
+ di << "Testing performance (Size | STL time | OCCT time | STL/OCCT boost)" << "\n";
- std::cout << "Testing performance (Size | STL time | OCCT time | STL/OCCT boost)\n";
-
- std::cout << std::endl << "std::vector vs NCollection_Array1 (sort):\n" << std::endl;
- TestPerformanceRandomIterator<NCollection_Array1<double>, std::vector<double> >();
-
- std::cout << std::endl << "std::vector vs NCollection_Vector (sort):\n" << std::endl;
- TestPerformanceRandomIterator<NCollection_Vector<double>, std::vector<double> >();
-
- std::cout << std::endl << "std::vector vs NCollection_Array1 (replace):\n" << std::endl;
- TestPerformanceForwardIterator<NCollection_Array1<double>, std::vector<double> >();
-
- std::cout << std::endl << "std::vector vs NCollection_Vector (replace):\n" << std::endl;
- TestPerformanceForwardIterator<NCollection_Vector<double>, std::vector<double> >();
-
- std::cout << std::endl << "std::list vs NCollection_List (replace):\n" << std::endl;
- TestPerformanceForwardIterator<NCollection_List<double>, std::list<double> >();
-
- std::cout << std::endl << "std::list vs NCollection_Sequence (replace):\n" << std::endl;
- TestPerformanceForwardIterator<NCollection_Sequence<double>, std::list<double> >();
+ di << "\n" << "std::vector vs NCollection_Array1 (sort):" << "\n\n";
+ TestPerformanceRandomIterator<NCollection_Array1<double>, std::vector<double> >(di);
+
+ di << "\n" << "std::vector vs NCollection_Vector (sort):" << "\n\n";
+ TestPerformanceRandomIterator<NCollection_Vector<double>, std::vector<double> >(di);
+
+ di << "\n" << "std::vector vs NCollection_Array1 (replace):" << "\n\n";
+ TestPerformanceForwardIterator<NCollection_Array1<double>, std::vector<double> >(di);
+
+ di << "\n" << "std::vector vs NCollection_Vector (replace):" << "\n\n";
+ TestPerformanceForwardIterator<NCollection_Vector<double>, std::vector<double> >(di);
- std::cout << std::endl << "std::list vs NCollection_Sequence (reverse):\n" << std::endl;
- TestPerformanceBidirIterator<NCollection_Sequence<double>, std::list<double> >();
+ di << "\n" << "std::list vs NCollection_List (replace):" << "\n\n";
+ TestPerformanceForwardIterator<NCollection_List<double>, std::list<double> >(di);
- std::cout << std::endl << "std::set vs NCollection_Map (search):\n" << std::endl;
- TestPerformanceMapAccess<NCollection_Map<int>, int>();
+ di << "\n" << "std::list vs NCollection_Sequence (replace):" << "\n\n";
+ TestPerformanceForwardIterator<NCollection_Sequence<double>, std::list<double> >(di);
- std::cout << std::endl << "std::set vs NCollection_IndexedMap (search):\n" << std::endl;
- TestPerformanceMapAccess<NCollection_IndexedMap<int>, int>();
+ di << "\n" << "std::list vs NCollection_Sequence (reverse):" << "\n\n";
+ TestPerformanceBidirIterator<NCollection_Sequence<double>, std::list<double> >(di);
- std::cout.unsetf (std::ios::floatfield);
+ di << "\n" << "std::set vs NCollection_Map (search):" << "\n\n";
+ TestPerformanceMapAccess<NCollection_Map<int>, int>(di);
+ di << "\n" << "std::set vs NCollection_IndexedMap (search):" << "\n\n";
+ TestPerformanceMapAccess<NCollection_IndexedMap<int>, int>(di);
+
return 0;
}