diff options
author | rcoh <rcoh@mit.edu> | 2011-01-04 17:23:30 -0500 |
---|---|---|
committer | rcoh <rcoh@mit.edu> | 2011-01-04 17:23:30 -0500 |
commit | 1679719e7ca8ce433c5714474a32c926161dc5b8 (patch) | |
tree | dc75dc66ee8695fe786df2b48c0e6911332ed7c5 /TestProfile.py | |
parent | 395e99394ead5d0d656e74fed23dc780652b6090 (diff) |
Some performance improvements -- we also synchronize all the frames, giving us a meaning that even
if things slow down, rendering doesn't look weird.
Diffstat (limited to 'TestProfile.py')
-rw-r--r-- | TestProfile.py | 32 |
1 files changed, 24 insertions, 8 deletions
diff --git a/TestProfile.py b/TestProfile.py index eccb884..342def6 100644 --- a/TestProfile.py +++ b/TestProfile.py @@ -1,5 +1,7 @@ -import cProfile -from LightInstallation import main +#import cProfile +import struct +import random +#from LightInstallation import main numiter = 10000000 def main1(): for i in xrange(0,numiter): @@ -18,17 +20,31 @@ def main2(): x = [1,2,3] a = [] def abc1(): - for i in xrange(0,numiter): + for i in range(0,numiter): a = min(4, 255) b = min(257, 255) def abc2(): - for i in xrange(0,numiter): + for i in range(0,numiter): a = 4 if 4 < 255 else 255 b = 257 if 257 < 255 else 255 -command = """abc1()""" -cProfile.runctx(command, globals(), locals()) +def strucpack(): + for i in xrange(0,numiter): + b = struct.pack('B', random.randint(0,255)) +def dictlookup(): + lookup = {} + for i in xrange(0,256): + 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()) +#command = """abc2()""" +#cProfile.runctx(command, globals(), locals()) |