Return-Path: Delivered-To: apmail-activemq-commits-archive@www.apache.org Received: (qmail 48896 invoked from network); 9 Jul 2007 17:30:37 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 9 Jul 2007 17:30:37 -0000 Received: (qmail 1954 invoked by uid 500); 9 Jul 2007 17:30:40 -0000 Delivered-To: apmail-activemq-commits-archive@activemq.apache.org Received: (qmail 1929 invoked by uid 500); 9 Jul 2007 17:30:40 -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 1916 invoked by uid 99); 9 Jul 2007 17:30:40 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 09 Jul 2007 10:30:40 -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; Mon, 09 Jul 2007 10:30:36 -0700 Received: by eris.apache.org (Postfix, from userid 65534) id 711C11A981A; Mon, 9 Jul 2007 10:30:16 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r554713 - in /activemq/activemq-cpp/trunk/src/test-benchmarks: Makefile.am activemq/util/MapBenchmark.cpp activemq/util/MapBenchmark.h activemq/util/SetBenchmark.cpp testRegistry.cpp Date: Mon, 09 Jul 2007 17:30:16 -0000 To: commits@activemq.apache.org From: tabish@apache.org X-Mailer: svnmailer-1.1.0 Message-Id: <20070709173016.711C11A981A@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: tabish Date: Mon Jul 9 10:30:14 2007 New Revision: 554713 URL: http://svn.apache.org/viewvc?view=rev&rev=554713 Log: http://issues.apache.org/activemq/browse/AMQCPP-128 Map Class Benchmark Added: activemq/activemq-cpp/trunk/src/test-benchmarks/activemq/util/MapBenchmark.cpp activemq/activemq-cpp/trunk/src/test-benchmarks/activemq/util/MapBenchmark.h Modified: activemq/activemq-cpp/trunk/src/test-benchmarks/Makefile.am activemq/activemq-cpp/trunk/src/test-benchmarks/activemq/util/SetBenchmark.cpp activemq/activemq-cpp/trunk/src/test-benchmarks/testRegistry.cpp Modified: activemq/activemq-cpp/trunk/src/test-benchmarks/Makefile.am URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/test-benchmarks/Makefile.am?view=diff&rev=554713&r1=554712&r2=554713 ============================================================================== --- activemq/activemq-cpp/trunk/src/test-benchmarks/Makefile.am (original) +++ activemq/activemq-cpp/trunk/src/test-benchmarks/Makefile.am Mon Jul 9 10:30:14 2007 @@ -20,6 +20,7 @@ activemq/util/PropertiesBenchmark.cpp \ activemq/util/QueueBenchmark.cpp \ activemq/util/SetBenchmark.cpp \ + activemq/util/MapBenchmark.cpp \ benchmark/PerformanceTimer.cpp \ testRegistry.cpp \ main.cpp @@ -29,6 +30,7 @@ activemq/util/PropertiesBenchmark.h \ activemq/util/QueueBenchmark.h \ activemq/util/SetBenchmark.h \ + activemq/util/MapBenchmark.h \ benchmark/BenchmarkBase.h \ benchmark/PerformanceTimer.h Added: activemq/activemq-cpp/trunk/src/test-benchmarks/activemq/util/MapBenchmark.cpp URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/test-benchmarks/activemq/util/MapBenchmark.cpp?view=auto&rev=554713 ============================================================================== --- activemq/activemq-cpp/trunk/src/test-benchmarks/activemq/util/MapBenchmark.cpp (added) +++ activemq/activemq-cpp/trunk/src/test-benchmarks/activemq/util/MapBenchmark.cpp Mon Jul 9 10:30:14 2007 @@ -0,0 +1,75 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "MapBenchmark.h" +#include + +using namespace activemq; +using namespace activemq::util; + +//////////////////////////////////////////////////////////////////////////////// +MapBenchmark::MapBenchmark() { +} + +//////////////////////////////////////////////////////////////////////////////// +void MapBenchmark::run() { + + int numRuns = 500; + std::string test = "test"; + std::string resultStr = ""; + Map stringCopy; + Map intCopy; + + for( int i = 0; i < numRuns; ++i ) { + stringMap.setValue( test + Integer::toString(i), test + Integer::toString(i) ); + intMap.setValue( 100 + i, 100 + i ); + stringMap.containsKey( test + Integer::toString(i) ); + intMap.containsKey( 100 + i ); + stringMap.containsValue( test + Integer::toString(i) ); + intMap.containsValue( 100 + i ); + } + + for( int i = 0; i < numRuns; ++i ) { + stringMap.remove( test + Integer::toString(i) ); + intMap.remove( 100 + i ); + stringMap.containsKey( test + Integer::toString(i) ); + intMap.containsKey( 100 + i ); + } + + for( int i = 0; i < numRuns; ++i ) { + stringMap.setValue( test + Integer::toString(i), test + Integer::toString(i) ); + intMap.setValue( 100 + i, 100 + i ); + } + + std::vector stringVec; + std::vector intVec; + + for( int i = 0; i < numRuns; ++i ) { + stringVec = stringMap.getKeys(); + stringVec = stringMap.getValues(); + intVec = intMap.getKeys(); + intVec = intMap.getValues(); + } + + for( int i = 0; i < numRuns; ++i ) { + stringCopy.copy( stringMap ); + stringCopy.clear(); + intCopy.copy( intMap ); + intCopy.clear(); + } + +} Added: activemq/activemq-cpp/trunk/src/test-benchmarks/activemq/util/MapBenchmark.h URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/test-benchmarks/activemq/util/MapBenchmark.h?view=auto&rev=554713 ============================================================================== --- activemq/activemq-cpp/trunk/src/test-benchmarks/activemq/util/MapBenchmark.h (added) +++ activemq/activemq-cpp/trunk/src/test-benchmarks/activemq/util/MapBenchmark.h Mon Jul 9 10:30:14 2007 @@ -0,0 +1,46 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef _ACTIVEMQ_UTIL_MAPBENCHMARK_H_ +#define _ACTIVEMQ_UTIL_MAPBENCHMARK_H_ + +#include +#include + +namespace activemq{ +namespace util{ + + class MapBenchmark : + public benchmark::BenchmarkBase< + activemq::util::MapBenchmark, Map > + { + private: + + Map< std::string, std::string> stringMap; + Map intMap; + + public: + + MapBenchmark(); + virtual ~MapBenchmark() {} + + virtual void run(); + }; + +}} + +#endif /*_ACTIVEMQ_UTIL_MAPBENCHMARK_H_*/ 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=554713&r1=554712&r2=554713 ============================================================================== --- activemq/activemq-cpp/trunk/src/test-benchmarks/activemq/util/SetBenchmark.cpp (original) +++ activemq/activemq-cpp/trunk/src/test-benchmarks/activemq/util/SetBenchmark.cpp Mon Jul 9 10:30:14 2007 @@ -61,12 +61,12 @@ stringVec = stringSet.toArray(); intVec = intSet.toArray(); } - - for( int i = 0; i < numRuns; ++i ) { - stringCopy.copy( stringSet ); - stringCopy.clear(); - intCopy.copy( intSet ); - intCopy.clear(); - } +// +// for( int i = 0; i < numRuns; ++i ) { +// stringCopy.copy( stringSet ); +// stringCopy.clear(); +// intCopy.copy( intSet ); +// intCopy.clear(); +// } } Modified: activemq/activemq-cpp/trunk/src/test-benchmarks/testRegistry.cpp URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/test-benchmarks/testRegistry.cpp?view=diff&rev=554713&r1=554712&r2=554713 ============================================================================== --- activemq/activemq-cpp/trunk/src/test-benchmarks/testRegistry.cpp (original) +++ activemq/activemq-cpp/trunk/src/test-benchmarks/testRegistry.cpp Mon Jul 9 10:30:14 2007 @@ -19,8 +19,10 @@ #include #include #include +#include CPPUNIT_TEST_SUITE_REGISTRATION( activemq::util::PrimitiveMapBenchmark ); CPPUNIT_TEST_SUITE_REGISTRATION( activemq::util::PropertiesBenchmark ); CPPUNIT_TEST_SUITE_REGISTRATION( activemq::util::QueueBenchmark ); CPPUNIT_TEST_SUITE_REGISTRATION( activemq::util::SetBenchmark ); +CPPUNIT_TEST_SUITE_REGISTRATION( activemq::util::MapBenchmark );