Ralph Bean avatar Ralph Bean committed c1b9dec

Nicer rst output

Comments (0)

Files changed (3)

 *.pyc
 *.swp
+*.pdf

tw2benchmark/main.py

     from widgets import test_wsgi_app_works
     test_wsgi_app_works()
 
+    print "tw2-benchmark"
+    print "============="
+    print "Comparing toscawidgets1 with tw2 for speed"
+    print
+
     passes = 10
     for test in map(str, range(1, 8)):
+        func = "test%s" % test
+        print func + " -" + getattr(widgets, func).__doc__ + "::"
         print
-        print "-" * 72
         for lib in ['tw1', 'tw2']:
             from timeit import Timer
-            func = "test%s" % test
             statement = "%s('%s')" % (func, lib)
             timer = Timer(
                 stmt=statement,
             )
             t = timer.repeat(passes, 10)
             _min, _max, _avg = min(t), max(t), sum(t)/len(t)
-            print "(%s)" % statement,
-            print "", getattr(widgets, func).__doc__
-            print "  min: %.4f usec/pass" % (passes * _min/passes),
-            print "  max: %.4f usec/pass" % (passes * _max/passes),
-            print "  avg: %.4f usec/pass" % (passes * _avg/passes)
+            print "  ", statement,
+            print "  min: %.4f" % (passes * _min/passes),
+            print "  max: %.4f" % (passes * _max/passes),
+            print "  avg: %.4f" % (passes * _avg/passes)
+
+        print

tw2benchmark/widgets.py

         foo = widget().display(boz='faz')
 
 def test6(lib):
-    """ Specifying parameters, then displaying many times. """
+    """ Specifying parameters once, then displaying many times. """
     widget = get_widget(lib)(boz='faz')
     for i in range(itertest_passes):
         widget.display(boz='faz')
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.