activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tab...@apache.org
Subject svn commit: r1375194 - in /activemq/activemq-cpp/trunk/activemq-cpp/src/test-benchmarks: ./ decaf/util/
Date Mon, 20 Aug 2012 20:00:17 GMT
Author: tabish
Date: Mon Aug 20 20:00:16 2012
New Revision: 1375194

URL: http://svn.apache.org/viewvc?rev=1375194&view=rev
Log:
Add some additional tests.

Added:
    activemq/activemq-cpp/trunk/activemq-cpp/src/test-benchmarks/decaf/util/HashMapBenchmark.cpp
  (with props)
    activemq/activemq-cpp/trunk/activemq-cpp/src/test-benchmarks/decaf/util/HashMapBenchmark.h
  (with props)
    activemq/activemq-cpp/trunk/activemq-cpp/src/test-benchmarks/decaf/util/StlMapBenchmark.cpp
      - copied, changed from r1367252, activemq/activemq-cpp/trunk/activemq-cpp/src/test-benchmarks/decaf/util/MapBenchmark.cpp
    activemq/activemq-cpp/trunk/activemq-cpp/src/test-benchmarks/decaf/util/StlMapBenchmark.h
      - copied, changed from r1367252, activemq/activemq-cpp/trunk/activemq-cpp/src/test-benchmarks/decaf/util/MapBenchmark.h
Removed:
    activemq/activemq-cpp/trunk/activemq-cpp/src/test-benchmarks/decaf/util/MapBenchmark.cpp
    activemq/activemq-cpp/trunk/activemq-cpp/src/test-benchmarks/decaf/util/MapBenchmark.h
Modified:
    activemq/activemq-cpp/trunk/activemq-cpp/src/test-benchmarks/Makefile.am
    activemq/activemq-cpp/trunk/activemq-cpp/src/test-benchmarks/testRegistry.cpp

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/test-benchmarks/Makefile.am
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/test-benchmarks/Makefile.am?rev=1375194&r1=1375193&r2=1375194&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/test-benchmarks/Makefile.am (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/test-benchmarks/Makefile.am Mon Aug 20 20:00:16
2012
@@ -26,7 +26,8 @@ cc_sources = \
     decaf/lang/BooleanBenchmark.cpp \
     decaf/lang/ThreadBenchmark.cpp \
     decaf/util/LinkedListBenchmark.cpp \
-    decaf/util/MapBenchmark.cpp \
+    decaf/util/StlMapBenchmark.cpp \
+    decaf/util/HashMapBenchmark.cpp \
     decaf/util/PropertiesBenchmark.cpp \
     decaf/util/QueueBenchmark.cpp \
     decaf/util/SetBenchmark.cpp \
@@ -47,7 +48,8 @@ h_sources = \
     decaf/lang/BooleanBenchmark.h \
     decaf/lang/ThreadBenchmark.h \
     decaf/util/LinkedListBenchmark.h \
-    decaf/util/MapBenchmark.h \
+    decaf/util/StlMapBenchmark.h \
+    decaf/util/HashMapBenchmark.h \
     decaf/util/PropertiesBenchmark.h \
     decaf/util/QueueBenchmark.h \
     decaf/util/SetBenchmark.h \

Added: activemq/activemq-cpp/trunk/activemq-cpp/src/test-benchmarks/decaf/util/HashMapBenchmark.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/test-benchmarks/decaf/util/HashMapBenchmark.cpp?rev=1375194&view=auto
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/test-benchmarks/decaf/util/HashMapBenchmark.cpp
(added)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/test-benchmarks/decaf/util/HashMapBenchmark.cpp
Mon Aug 20 20:00:16 2012
@@ -0,0 +1,83 @@
+/*
+ * 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 "HashMapBenchmark.h"
+
+#include <decaf/lang/Integer.h>
+#include <decaf/util/StlMap.h>
+
+using namespace decaf;
+using namespace decaf::util;
+using namespace decaf::lang;
+
+////////////////////////////////////////////////////////////////////////////////
+HashMapBenchmark::HashMapBenchmark() {
+}
+
+////////////////////////////////////////////////////////////////////////////////
+HashMapBenchmark::~HashMapBenchmark() {
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void HashMapBenchmark::run() {
+
+    int numRuns = 500;
+    std::string test = "test";
+    std::string resultStr = "";
+    StlMap<std::string, std::string> stringCopy;
+    StlMap<int, int> intCopy;
+
+    for( int i = 0; i < numRuns; ++i ) {
+        stringMap.put( test + Integer::toString(i), test + Integer::toString(i) );
+        intMap.put( 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.put( test + Integer::toString(i), test + Integer::toString(i) );
+        intMap.put( 100 + i, 100 + i );
+    }
+
+    for( int i = 0; i < numRuns / 2; ++i ) {
+        Set<std::string>& stringSet = stringMap.keySet();
+        stringSet.size();
+        Collection<std::string>& stringCol = stringMap.values();
+        stringCol.size();
+        Set<int>& intSet = intMap.keySet();
+        intSet.size();
+        Collection<int>& intCol = intMap.values();
+        intCol.size();
+    }
+
+    for( int i = 0; i < numRuns / 2; ++i ) {
+        stringCopy.copy( stringMap );
+        stringCopy.clear();
+        intCopy.copy( intMap );
+        intCopy.clear();
+    }
+
+}

Propchange: activemq/activemq-cpp/trunk/activemq-cpp/src/test-benchmarks/decaf/util/HashMapBenchmark.cpp
------------------------------------------------------------------------------
    svn:eol-style = native

Added: activemq/activemq-cpp/trunk/activemq-cpp/src/test-benchmarks/decaf/util/HashMapBenchmark.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/test-benchmarks/decaf/util/HashMapBenchmark.h?rev=1375194&view=auto
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/test-benchmarks/decaf/util/HashMapBenchmark.h
(added)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/test-benchmarks/decaf/util/HashMapBenchmark.h
Mon Aug 20 20:00:16 2012
@@ -0,0 +1,45 @@
+/*
+ * 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 _DECAF_UTIL_HASHMAPBENCHMARK_H_
+#define _DECAF_UTIL_HASHMAPBENCHMARK_H_
+
+#include <benchmark/BenchmarkBase.h>
+#include <decaf/util/HashMap.h>
+
+namespace decaf {
+namespace util {
+
+    class HashMapBenchmark :
+        public benchmark::BenchmarkBase<decaf::util::HashMapBenchmark, HashMap<int,
int> > {
+    private:
+
+        HashMap<std::string, std::string> stringMap;
+        HashMap<int, int> intMap;
+
+    public:
+
+        HashMapBenchmark();
+        virtual ~HashMapBenchmark();
+
+        virtual void run();
+
+    };
+
+}}
+
+#endif /* _DECAF_UTIL_HASHMAPBENCHMARK_H_ */

Propchange: activemq/activemq-cpp/trunk/activemq-cpp/src/test-benchmarks/decaf/util/HashMapBenchmark.h
------------------------------------------------------------------------------
    svn:eol-style = native

Copied: activemq/activemq-cpp/trunk/activemq-cpp/src/test-benchmarks/decaf/util/StlMapBenchmark.cpp
(from r1367252, activemq/activemq-cpp/trunk/activemq-cpp/src/test-benchmarks/decaf/util/MapBenchmark.cpp)
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/test-benchmarks/decaf/util/StlMapBenchmark.cpp?p2=activemq/activemq-cpp/trunk/activemq-cpp/src/test-benchmarks/decaf/util/StlMapBenchmark.cpp&p1=activemq/activemq-cpp/trunk/activemq-cpp/src/test-benchmarks/decaf/util/MapBenchmark.cpp&r1=1367252&r2=1375194&rev=1375194&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/test-benchmarks/decaf/util/MapBenchmark.cpp
(original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/test-benchmarks/decaf/util/StlMapBenchmark.cpp
Mon Aug 20 20:00:16 2012
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-#include "MapBenchmark.h"
+#include "StlMapBenchmark.h"
 #include <decaf/lang/Integer.h>
 #include <decaf/util/StlMap.h>
 
@@ -24,11 +24,11 @@ using namespace decaf::util;
 using namespace decaf::lang;
 
 ////////////////////////////////////////////////////////////////////////////////
-MapBenchmark::MapBenchmark() : stringMap(), intMap() {
+StlMapBenchmark::StlMapBenchmark() : stringMap(), intMap() {
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-void MapBenchmark::run() {
+void StlMapBenchmark::run() {
 
     int numRuns = 500;
     std::string test = "test";

Copied: activemq/activemq-cpp/trunk/activemq-cpp/src/test-benchmarks/decaf/util/StlMapBenchmark.h
(from r1367252, activemq/activemq-cpp/trunk/activemq-cpp/src/test-benchmarks/decaf/util/MapBenchmark.h)
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/test-benchmarks/decaf/util/StlMapBenchmark.h?p2=activemq/activemq-cpp/trunk/activemq-cpp/src/test-benchmarks/decaf/util/StlMapBenchmark.h&p1=activemq/activemq-cpp/trunk/activemq-cpp/src/test-benchmarks/decaf/util/MapBenchmark.h&r1=1367252&r2=1375194&rev=1375194&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/test-benchmarks/decaf/util/MapBenchmark.h
(original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/test-benchmarks/decaf/util/StlMapBenchmark.h
Mon Aug 20 20:00:16 2012
@@ -15,8 +15,8 @@
  * limitations under the License.
  */
 
-#ifndef _DECAF_UTIL_MAPBENCHMARK_H_
-#define _DECAF_UTIL_MAPBENCHMARK_H_
+#ifndef _DECAF_UTIL_STLMAPBENCHMARK_H_
+#define _DECAF_UTIL_STLMAPBENCHMARK_H_
 
 #include <benchmark/BenchmarkBase.h>
 #include <decaf/util/StlMap.h>
@@ -24,23 +24,21 @@
 namespace decaf{
 namespace util{
 
-    class MapBenchmark :
-        public benchmark::BenchmarkBase<
-            decaf::util::MapBenchmark, Map<int, int> >
-    {
+    class StlMapBenchmark :
+        public benchmark::BenchmarkBase<decaf::util::StlMapBenchmark, StlMap<int, int>
> {
     private:
 
-        StlMap< std::string, std::string> stringMap;
+        StlMap<std::string, std::string> stringMap;
         StlMap<int, int> intMap;
 
     public:
 
-        MapBenchmark();
-        virtual ~MapBenchmark() {}
+        StlMapBenchmark();
+        virtual ~StlMapBenchmark() {}
 
         virtual void run();
     };
 
 }}
 
-#endif /*_DECAF_UTIL_MAPBENCHMARK_H_*/
+#endif /*_DECAF_UTIL_STLMAPBENCHMARK_H_*/

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/test-benchmarks/testRegistry.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/test-benchmarks/testRegistry.cpp?rev=1375194&r1=1375193&r2=1375194&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/test-benchmarks/testRegistry.cpp (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/test-benchmarks/testRegistry.cpp Mon Aug
20 20:00:16 2012
@@ -29,8 +29,10 @@ CPPUNIT_TEST_SUITE_REGISTRATION( decaf::
 CPPUNIT_TEST_SUITE_REGISTRATION( decaf::util::QueueBenchmark );
 #include <decaf/util/SetBenchmark.h>
 CPPUNIT_TEST_SUITE_REGISTRATION( decaf::util::SetBenchmark );
-#include <decaf/util/MapBenchmark.h>
-CPPUNIT_TEST_SUITE_REGISTRATION( decaf::util::MapBenchmark );
+#include <decaf/util/StlMapBenchmark.h>
+CPPUNIT_TEST_SUITE_REGISTRATION( decaf::util::StlMapBenchmark );
+#include <decaf/util/HashMapBenchmark.h>
+CPPUNIT_TEST_SUITE_REGISTRATION( decaf::util::HashMapBenchmark );
 #include <decaf/util/StlListBenchmark.h>
 CPPUNIT_TEST_SUITE_REGISTRATION( decaf::util::StlListBenchmark );
 #include <decaf/util/LinkedListBenchmark.h>



Mime
View raw message