From commits-return-6546-apmail-activemq-commits-archive=activemq.apache.org@activemq.apache.org Tue Jul 10 23:26:18 2007 Return-Path: Delivered-To: apmail-activemq-commits-archive@www.apache.org Received: (qmail 65135 invoked from network); 10 Jul 2007 23:26:17 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 10 Jul 2007 23:26:17 -0000 Received: (qmail 18184 invoked by uid 500); 10 Jul 2007 23:26:20 -0000 Delivered-To: apmail-activemq-commits-archive@activemq.apache.org Received: (qmail 18134 invoked by uid 500); 10 Jul 2007 23:26:20 -0000 Mailing-List: contact commits-help@activemq.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@activemq.apache.org Delivered-To: mailing list commits@activemq.apache.org Received: (qmail 18124 invoked by uid 99); 10 Jul 2007 23:26:20 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 10 Jul 2007 16:26:20 -0700 X-ASF-Spam-Status: No, hits=-99.5 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from [140.211.11.3] (HELO eris.apache.org) (140.211.11.3) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 10 Jul 2007 16:26:17 -0700 Received: by eris.apache.org (Postfix, from userid 65534) id AE8411A9820; Tue, 10 Jul 2007 16:25:56 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r555112 - /activemq/activemq-cpp/trunk/src/test-benchmarks/activemq/util/SetBenchmark.cpp Date: Tue, 10 Jul 2007 23:25:56 -0000 To: commits@activemq.apache.org From: tabish@apache.org X-Mailer: svnmailer-1.1.0 Message-Id: <20070710232556.AE8411A9820@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org 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 +#include using namespace activemq; using namespace activemq::util; @@ -57,16 +58,36 @@ std::vector stringVec; std::vector 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* strIter = stringSet.iterator(); + Iterator* 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(); + } }