From 1679719e7ca8ce433c5714474a32c926161dc5b8 Mon Sep 17 00:00:00 2001 From: rcoh Date: Tue, 4 Jan 2011 17:23:30 -0500 Subject: Some performance improvements -- we also synchronize all the frames, giving us a meaning that even if things slow down, rendering doesn't look weird. --- TestProfile.py | 32 ++++++++++++++++++++++++-------- 1 file changed, 24 insertions(+), 8 deletions(-) (limited to 'TestProfile.py') 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()) -- cgit v1.2.3