aboutsummaryrefslogtreecommitdiff
path: root/TestProfile.py
diff options
context:
space:
mode:
authorGravatar Thomas B Thompson <tbent@spice.(none)>2011-01-10 22:23:49 -0500
committerGravatar Thomas B Thompson <tbent@spice.(none)>2011-01-10 22:23:49 -0500
commitbb1d982669c44a990ffc926f4666b6aa72237619 (patch)
treeb3d3e3e48423d89658cc11608d17bbee5d92a8d8 /TestProfile.py
parent21e961d8074570cca27b2661582d728be85b18b9 (diff)
Worked on getting the threading stuff consolidated in ThreadedSmootCoreObject. Also set up a decent system for SmootCoreObjects to kill the whole application in a managed fashion.
Diffstat (limited to 'TestProfile.py')
-rw-r--r--TestProfile.py51
1 files changed, 39 insertions, 12 deletions
diff --git a/TestProfile.py b/TestProfile.py
index 342def6..d6f24c1 100644
--- a/TestProfile.py
+++ b/TestProfile.py
@@ -1,8 +1,10 @@
-#import cProfile
+import cProfile
import struct
import random
+import scipy.weave as weave
+import math
#from LightInstallation import main
-numiter = 10000000
+numiter = 1000000
def main1():
for i in xrange(0,numiter):
if 'abc' == 'def':
@@ -37,14 +39,39 @@ def dictlookup():
lookup[i] = struct.pack('B', random.randint(0,255))
for i in xrange(0,numiter):
b = lookup[random.randint(0,255)]
-print('starting')
-abc1()
-print('starting')
-abc2()
-print('done')
-#command = """abc1()"""
-#cProfile.runctx(command, globals(), locals())
-
-#command = """abc2()"""
-#cProfile.runctx(command, globals(), locals())
+#print('starting')
+#abc1()
+#print('starting')
+#abc2()
+#print('done')
+
+def normal_python():
+ for i in xrange(0,numiter):
+ a = math.sqrt(3 + 4 + 5)
+
+def weave_outloop():
+ code = """
+ float x = 0;
+ for (int i = 0;i < numiter;i++) {
+ x = sqrt(3 + 4 + 5);
+ }
+ """
+ weave.inline(code, ['numiter'])
+
+def weave_inloop():
+ code = """
+ x = sqrt(3 + 4 + 5);
+ """
+ x = 0.0
+ for i in xrange(0,numiter):
+ weave.inline(code, ['x'])
+
+command = """normal_python()"""
+cProfile.runctx(command, globals(), locals())
+
+command = """weave_outloop()"""
+cProfile.runctx(command, globals(), locals())
+
+command = """weave_inloop()"""
+cProfile.runctx(command, globals(), locals())