Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Python: Dev

Re: cpython: Issue #14428: Use the new time.perf_counter() and time.process_time() functions

 

 

Python dev RSS feed   Index | Next | Previous | View Threaded


g.brandl at gmx

Apr 30, 2012, 3:52 AM

Post #1 of 3 (96 views)
Permalink
Re: cpython: Issue #14428: Use the new time.perf_counter() and time.process_time() functions

On 29.04.2012 03:04, victor.stinner wrote:
> http://hg.python.org/cpython/rev/bd195749c0a2
> changeset: 76599:bd195749c0a2
> user: Victor Stinner <victor.stinner [at] gmail>
> date: Sun Apr 29 03:01:20 2012 +0200
> summary:
> Issue #14428: Use the new time.perf_counter() and time.process_time() functions

[...]

> diff --git a/Lib/timeit.py b/Lib/timeit.py
> --- a/Lib/timeit.py
> +++ b/Lib/timeit.py
> @@ -15,8 +15,8 @@
> -n/--number N: how many times to execute 'statement' (default: see below)
> -r/--repeat N: how many times to repeat the timer (default 3)
> -s/--setup S: statement to be executed once initially (default 'pass')
> - -t/--time: use time.time() (default on Unix)
> - -c/--clock: use time.clock() (default on Windows)
> + -t/--time: use time.time()
> + -c/--clock: use time.clock()

Does it make sense to keep the options this way? IMO the distinction should be
to use either perf_counter() or process_time(), and the options could implement
this (-t -> perf_counter, -c -> process_time).

Georg


_______________________________________________
Python-Dev mailing list
Python-Dev [at] python
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: http://mail.python.org/mailman/options/python-dev/list-python-dev%40lists.gossamer-threads.com


victor.stinner at gmail

May 1, 2012, 1:35 AM

Post #2 of 3 (84 views)
Permalink
Re: cpython: Issue #14428: Use the new time.perf_counter() and time.process_time() functions [In reply to]

>> diff --git a/Lib/timeit.py b/Lib/timeit.py
>> --- a/Lib/timeit.py
>> +++ b/Lib/timeit.py
>> @@ -15,8 +15,8 @@
>>    -n/--number N: how many times to execute 'statement' (default: see below)
>>    -r/--repeat N: how many times to repeat the timer (default 3)
>>    -s/--setup S: statement to be executed once initially (default 'pass')
>> -  -t/--time: use time.time() (default on Unix)
>> -  -c/--clock: use time.clock() (default on Windows)
>> +  -t/--time: use time.time()
>> +  -c/--clock: use time.clock()
>
> Does it make sense to keep the options this way?  IMO the distinction should be
> to use either perf_counter() or process_time(), and the options could implement
> this (-t -> perf_counter, -c -> process_time).

You might need to use exactly the same clock to compare performance of
Python 3.2 and 3.3.

Adding an option to use time.process_time() is a good idea. Is anyone
interested to implement it?

Victor
_______________________________________________
Python-Dev mailing list
Python-Dev [at] python
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: http://mail.python.org/mailman/options/python-dev/list-python-dev%40lists.gossamer-threads.com


g.brandl at gmx

May 1, 2012, 2:59 AM

Post #3 of 3 (85 views)
Permalink
Re: cpython: Issue #14428: Use the new time.perf_counter() and time.process_time() functions [In reply to]

On 01.05.2012 10:35, Victor Stinner wrote:
>>> diff --git a/Lib/timeit.py b/Lib/timeit.py
>>> --- a/Lib/timeit.py
>>> +++ b/Lib/timeit.py
>>> @@ -15,8 +15,8 @@
>>> -n/--number N: how many times to execute 'statement' (default: see below)
>>> -r/--repeat N: how many times to repeat the timer (default 3)
>>> -s/--setup S: statement to be executed once initially (default 'pass')
>>> - -t/--time: use time.time() (default on Unix)
>>> - -c/--clock: use time.clock() (default on Windows)
>>> + -t/--time: use time.time()
>>> + -c/--clock: use time.clock()
>>
>> Does it make sense to keep the options this way? IMO the distinction should be
>> to use either perf_counter() or process_time(), and the options could implement
>> this (-t -> perf_counter, -c -> process_time).
>
> You might need to use exactly the same clock to compare performance of
> Python 3.2 and 3.3.
>
> Adding an option to use time.process_time() is a good idea. Is anyone
> interested to implement it?

I implemented it in d43a8aa9dbef. I also updated the docs in 552c207f65e4.

Georg

_______________________________________________
Python-Dev mailing list
Python-Dev [at] python
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: http://mail.python.org/mailman/options/python-dev/list-python-dev%40lists.gossamer-threads.com

Python dev RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.