From 134de4472d3f2fa913944770595de9221dd27fdf Mon Sep 17 00:00:00 2001 From: Thomas B Thompson Date: Tue, 4 Jan 2011 00:04:05 -0500 Subject: worked on profiling, made a bunch of changes, huge speedup! --- TestProfile.py | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 TestProfile.py (limited to 'TestProfile.py') diff --git a/TestProfile.py b/TestProfile.py new file mode 100644 index 0000000..eccb884 --- /dev/null +++ b/TestProfile.py @@ -0,0 +1,34 @@ +import cProfile +from LightInstallation import main +numiter = 10000000 +def main1(): + for i in xrange(0,numiter): + if 'abc' == 'def': + pass + if 'abc' == 'abc': + pass + +def main2(): + for i in xrange(0,numiter): + if 1 == 2: + pass + if 1 == 1: + pass + +x = [1,2,3] +a = [] +def abc1(): + for i in xrange(0,numiter): + a = min(4, 255) + b = min(257, 255) + +def abc2(): + for i in xrange(0,numiter): + a = 4 if 4 < 255 else 255 + b = 257 if 257 < 255 else 255 +command = """abc1()""" +cProfile.runctx(command, globals(), locals()) + +command = """abc2()""" +cProfile.runctx(command, globals(), locals()) + -- cgit v1.2.3