Anonymous avatar Anonymous committed cc9d34f Merge

Automated merge with ssh://bitbucket.org/bromer/pupympi

Comments (0)

Files changed (1)

pupympi/internal_tests/serialize_speed_test.py

 
 # Test objects and nice descriptions
 
-i1 = (42, "a simple small int")
-i2 = (sys.maxint, "a really big int")
+i1 = (42, "small.int")
+i2 = (sys.maxint, "big.int")
 
-sl1 = (range(small), "a small(%i) int list" % small)
+sl1 = (range(small), "%i;int.list" % small)
 
-ml1 = (range(medium), "a medium(%i) int list" % medium)
-ml2 = ([ i*1.0/3.0 for i in range(medium) ], "a medium(%i) float list" % medium)
+ml1 = (range(medium), "%i;int.list" % medium)
+ml2 = ([ i*1.0/3.0 for i in range(medium) ], "%i;float.list" % medium)
 
-ll1 = (range(large), "a large(%i) int list" % large)
-ll2 = ([ i*1.0/3.0 for i in range(large) ], "a large(%i) float list" % large)
+ll1 = (range(large), "%i;int.list" % large)
+ll2 = ([ i*1.0/3.0 for i in range(large) ], "%i;float.list" % large)
 
 na1 = (numpy.array(range(small), dtype='int64'), "%i;numpy.int64" % small)
 na2 = (numpy.array(range(medium), dtype='int64'), "%i;numpy.int64" % medium)
     for serializer in pickle_methods:
         for data, desc, scale in testdata:
             repetitions = r * scale
-            with timing("%s dump+load reps:%i %s" % (serializer.__name__, repetitions,desc),repetitions):
+            with timing("%s;load;reps:%i;%s" % (serializer.__name__, repetitions,desc),repetitions):
                 for i in xrange(repetitions):
                     s = serializer.dumps(data)
                     l = serializer.loads(s)
                                 s = data.tostring()
                                 l = numpy.fromstring(s,dtype=t)
                     elif serializer == '.tostring b':
-                        with timing("%s;frombuffer;reps:%i;%s" % (serializer, repetitions,desc),repetitions):
+                        serializer_name = '.tostring'
+                        with timing("%s;frombuffer;reps:%i;%s" % (serializer_name, repetitions,desc),repetitions):
                             for i in xrange(repetitions):
                                 t = data.dtype
                                 s = data.tostring()
 
 # do it
 if __name__ == "__main__":
-    plainrunner(1000)
+    import sys
+    try:
+        reps = int(sys.argv[1])
+    except:
+        reps = 1000
+    plainrunner(reps)
     #plainrunner(1000, testdata=numpydata)
 
     #numpyrunner(10)
-    numpyrunner(1000)
+    numpyrunner(reps)
     #numpyrunner(100, testdata=smalldata+bigdata)
     #numpyrunner(100, testdata=numpydata)
 
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.