[Tutor] compile time calculator
suryak at live.com
Sat Jan 28 14:50:34 CET 2012
Date: Fri, 27 Jan 2012 17:35:39 -0800
Subject: Re: [Tutor] compile time calculator
From: marc.tompkins at gmail.com
To: suryak at live.com
CC: tutor at python.org
On Fri, Jan 27, 2012 at 7:46 AM, Surya K <suryak at live.com> wrote:
I want to calculate compile time for my puzzles.
Since nobody else has mentioned it yet...
Well, using python documentation, I did this..
(calculating execution time).
def main():## This is my whole puzzle code...
fobj_ip = open('D:/code/py/input.txt', 'r') fobj_op = open('D:/code/py/output.txt','w')
line=1 for eachLine in fobj_ip: if line>1: fobj_op.write ("Case #%d: %d\n" %(line-1, the_count(eachLine) ) ) line+=1
if __name__ == '__main__': from timeit import Timer main() t = Timer("main()") print t.timeit()
This is showing the following output
10000000 loops, best of 3: 0.0612 usec per loop
(This is repeating...)
So, what exactly is 0.0612 usec per loop, is that execution time of my whole program??If, how do I calculate it in seconds.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Tutor