You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by ta...@apache.org on 2007/07/11 01:25:56 UTC
svn commit: r555112 -
/activemq/activemq-cpp/trunk/src/test-benchmarks/activemq/util/SetBenchmark.cpp
Author: tabish
Date: Tue Jul 10 16:25:55 2007
New Revision: 555112
URL: http://svn.apache.org/viewvc?view=rev&rev=555112
Log:
http://issues.apache.org/activemq/browse/AMQCPP-128
Adding Iterator to the Collections classes to avoid having to call toArray as much.
Modified:
activemq/activemq-cpp/trunk/src/test-benchmarks/activemq/util/SetBenchmark.cpp
Modified: activemq/activemq-cpp/trunk/src/test-benchmarks/activemq/util/SetBenchmark.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/test-benchmarks/activemq/util/SetBenchmark.cpp?view=diff&rev=555112&r1=555111&r2=555112
==============================================================================
--- activemq/activemq-cpp/trunk/src/test-benchmarks/activemq/util/SetBenchmark.cpp (original)
+++ activemq/activemq-cpp/trunk/src/test-benchmarks/activemq/util/SetBenchmark.cpp Tue Jul 10 16:25:55 2007
@@ -18,6 +18,7 @@
#include "SetBenchmark.h"
#include <activemq/util/Integer.h>
+#include <activemq/util/Iterator.h>
using namespace activemq;
using namespace activemq::util;
@@ -57,16 +58,36 @@
std::vector<std::string> stringVec;
std::vector<int> intVec;
- for( int i = 0; i < numRuns; ++i ) {
+ for( int i = 0; i < numRuns / 2; ++i ) {
stringVec = stringSet.toArray();
intVec = intSet.toArray();
}
-//
-// for( int i = 0; i < numRuns; ++i ) {
-// stringCopy.copy( stringSet );
-// stringCopy.clear();
-// intCopy.copy( intSet );
-// intCopy.clear();
-// }
+
+ std::string tempStr = "";
+ int tempInt = 0;
+
+ for( int i = 0; i < numRuns / 2; ++i ) {
+
+ Iterator<std::string>* strIter = stringSet.iterator();
+ Iterator<int>* intIter = intSet.iterator();
+
+ while( strIter->hasNext() ){
+ tempStr = strIter->next();
+ }
+
+ while( intIter->hasNext() ){
+ tempInt = intIter->next();
+ }
+
+ delete strIter;
+ delete intIter;
+ }
+
+ for( int i = 0; i < numRuns / 2; ++i ) {
+ stringCopy.copy( stringSet );
+ stringCopy.clear();
+ intCopy.copy( intSet );
+ intCopy.clear();
+ }
}