tee chwee liong wrote:
hi,
i would like to know the time taken to execute a certain task in python. i used time.time and time.clock and i see the time taken is different? what is the right method to use?
Neither, or either. For timing small code snippets, the right tool is
the timeit module
u are effectively profiling a single if statement...
Alan Gauld
Author of the Learn To Program website
http://www.alan-g.me.uk/
From: tee chwee liong
To: alan.ga...@btinternet.com; tutor@python.org
Sent: Thursday, 17 March, 2011 9:06:56
Subject: RE: [Tutor] time tak
hi,
i used profiler. but it gives 0 sec? is this expected? tq
>>> profile.run('import math')
3 function calls in 0.000 CPU seconds
Ordered by: standard name
ncalls tottime percall cumtime percall filename:lineno(function)
10.0000.0000.0000.000 :0(set
"tee chwee liong" wrote
i would like to know the time taken to execute a
certain task in python. i used time.time and time.clock
and i see the time taken is different?
what is the right method to use?
Neither of those, either use timeit() or the Python profiler.
They are both specifically
On 3/16/11, tee chwee liong wrote:
>
> hi,
>
> i would like to know the time taken to execute a certain task in python. i
> used time.time and time.clock and i see the time taken is different? what is
> the right method to use?
>
> import time
> def testtime(num):
> start=time.time()
> #pr
On Wed, Mar 16, 2011 at 9:40 PM, tee chwee liong wrote:
> hi,
>
> i would like to know the time taken to execute a certain task in python. i
> used time.time and time.clock and i see the time taken is different? what is
> the right method to use?
>
> import time
> def testtime(num):
> start=