Movatterモバイル変換


[0]ホーム

URL:


homepage

Issue18983

This issue trackerhas been migrated toGitHub, and is currentlyread-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title:Specify time unit for timeit CLI
Type:enhancementStage:resolved
Components:Library (Lib)Versions:Python 3.5
process
Status:closedResolution:fixed
Dependencies:Superseder:
Assigned To:Nosy List: Julian.Gindi, Quentin.Pradet, Vincentdavis, berker.peksag, ezio.melotti, georg.brandl, jstasiak, pitrou, python-dev, rbcollins, serhiy.storchaka, tim.peters, vajrasky
Priority:normalKeywords:easy, patch

Created on2013-09-08 21:15 byserhiy.storchaka, last changed2022-04-11 14:57 byadmin. This issue is nowclosed.

Files
File nameUploadedDescriptionEdit
issue18983.patchJulian.Gindi,2013-11-26 22:33review
issue18983.patchJulian.Gindi,2013-11-27 18:03review
issue18983_v2.patchJulian.Gindi,2013-12-09 14:40review
issue18983_v3.patchJulian.Gindi,2013-12-09 17:58review
issue18983_v4.patchJulian.Gindi,2013-12-09 19:28review
issue18983_v5.patchJulian.Gindi,2013-12-09 19:54review
issue18983_v5.patchJulian.Gindi,2013-12-09 20:14review
issue18983_v6.patchJulian.Gindi,2013-12-11 21:56review
Messages (27)
msg197322 -(view)Author: Serhiy Storchaka (serhiy.storchaka)*(Python committer)Date: 2013-09-08 21:15
Just an idea. Currently the timeit module in command line automatically choice most appropriate time unit for human readable output. But this makes the output less machine readable. I propose to add new option which specifies fixed time unit (usec, msec, sec).
msg197333 -(view)Author: Antoine Pitrou (pitrou)*(Python committer)Date: 2013-09-08 22:36
If you want the output to be machine readable, better go the full way and add a --json option, IMO.
msg197345 -(view)Author: Jakub Stasiak (jstasiak)*Date: 2013-09-09 01:11
My 2 cents - I'd split timeit.main function into processing part and argument parsing + data printing part so that you could use Python to call the first one to get the actual results (timings, numbers of loops etc.) and then present the data to the outside world in any needed format - no text parsing needed.
msg204541 -(view)Author: Julian Gindi (Julian.Gindi)*Date: 2013-11-26 22:33
I created a patch that allows users to specify a time unit output using the "-u" flag. Example usage:python -m timeit -u "msec" '"-".join(str(n) for n in range(100))'>> 10000 loops, best of 3: 0.156 msec per looppython -m timeit -u "sec" '"-".join(str(n) for n in range(100))'>> 10000 loops, best of 3: 0.000159 sec per loopYou can specify msec, sec, or usec. I am also interested in having a JSON option as mentioned by Antoine. Any thoughts?
msg204606 -(view)Author: Julian Gindi (Julian.Gindi)*Date: 2013-11-27 18:03
Updated patch to include unit tests.
msg205612 -(view)Author: Julian Gindi (Julian.Gindi)*Date: 2013-12-08 22:13
Just wanted to check to see if there was anything else I should do regarding this issue.
msg205697 -(view)Author: Julian Gindi (Julian.Gindi)*Date: 2013-12-09 14:40
Implemented proposed changes to patch. Simplified "for-loop" and implemented invalid input test.
msg205720 -(view)Author: Julian Gindi (Julian.Gindi)*Date: 2013-12-09 17:58
Incorporated updates suggested by serhiy.storchaka
msg205723 -(view)Author: Serhiy Storchaka (serhiy.storchaka)*(Python committer)Date: 2013-12-09 18:21
It will be better to write error message to sys.stderr (see test_main_exception).
msg205731 -(view)Author: Julian Gindi (Julian.Gindi)*Date: 2013-12-09 19:28
Updated patch to log to stderr.
msg205736 -(view)Author: Julian Gindi (Julian.Gindi)*Date: 2013-12-09 19:54
Added newline after error message.
msg205737 -(view)Author: Serhiy Storchaka (serhiy.storchaka)*(Python committer)Date: 2013-12-09 20:12
The patch is doubled.
msg205738 -(view)Author: Julian Gindi (Julian.Gindi)*Date: 2013-12-09 20:14
Whoops. Sorry about that. Super embarrassing.
msg205914 -(view)Author: Julian Gindi (Julian.Gindi)*Date: 2013-12-11 18:57
Re-uploaded the patch to remove duplication.
msg205922 -(view)Author: Serhiy Storchaka (serhiy.storchaka)*(Python committer)Date: 2013-12-11 20:28
Besides too long line with sys.stderr.write last patch LGTM.
msg205923 -(view)Author: Serhiy Storchaka (serhiy.storchaka)*(Python committer)Date: 2013-12-11 20:29
Ah, I forgot. This feature should be documented inDoc/library/timeit.rst.
msg205931 -(view)Author: Julian Gindi (Julian.Gindi)*Date: 2013-12-11 21:56
Updated documentation and fixed a few lines that were too long.
msg206834 -(view)Author: Julian Gindi (Julian.Gindi)*Date: 2013-12-22 22:26
Just wanted to check in and see if the documentation change I made is sufficient. I tried to copy the other entries for the command line arguments. Let me know if I can improve it in any way.
msg206869 -(view)Author: Serhiy Storchaka (serhiy.storchaka)*(Python committer)Date: 2013-12-23 17:04
LGTM.
msg207990 -(view)Author: Julian Gindi (Julian.Gindi)*Date: 2014-01-13 01:01
What needs to be done to close this one out?
msg207995 -(view)Author: Vajrasky Kok (vajrasky)*Date: 2014-01-13 01:41
This feature is for Python 3.5. I think, we will not commit anything to Python 3.5 until Python 3.4 branch is created (in other world, released). So, be patient. :)
msg216024 -(view)Author: Quentin Pradet (Quentin.Pradet)*Date: 2014-04-13 16:08
The branch appears to exist now.
msg226093 -(view)Author: Julian Gindi (Julian.Gindi)*Date: 2014-08-29 22:26
Anything else need to be done on this patch?
msg233346 -(view)Author: Vincent Davis (Vincentdavis)Date: 2015-01-03 04:16
Anything else need to be done on this patch?
msg233348 -(view)Author: Berker Peksag (berker.peksag)*(Python committer)Date: 2015-01-03 04:35
I've added a couple of comments on Rietveld.
msg238337 -(view)Author: Roundup Robot (python-dev)(Python triager)Date: 2015-03-17 20:55
New changeset1ebf8d5b7d60 by Robert Collins in branch 'default':Issue#18983: Allow selection of output units in timeit.https://hg.python.org/cpython/rev/1ebf8d5b7d60
msg238338 -(view)Author: Roundup Robot (python-dev)(Python triager)Date: 2015-03-17 20:59
New changeseted34dd00405e by Robert Collins in branch 'default':Fix patch attribution forissue 18983.https://hg.python.org/cpython/rev/ed34dd00405e
History
DateUserActionArgs
2022-04-11 14:57:50adminsetgithub: 63183
2015-03-17 21:01:41rbcollinssetstatus: open -> closed
nosy: +rbcollins

resolution: fixed
stage: patch review -> resolved
2015-03-17 20:59:45python-devsetmessages: +msg238338
2015-03-17 20:55:09python-devsetnosy: +python-dev
messages: +msg238337
2015-01-03 04:35:20berker.peksagsetnosy: +berker.peksag
messages: +msg233348
2015-01-03 04:16:42Vincentdavissetnosy: +Vincentdavis
messages: +msg233346
2014-08-29 22:26:55Julian.Gindisetmessages: +msg226093
2014-04-13 16:08:58Quentin.Pradetsetnosy: +Quentin.Pradet
messages: +msg216024
2014-01-13 01:41:22vajraskysetnosy: +vajrasky
messages: +msg207995
2014-01-13 01:01:56Julian.Gindisetmessages: +msg207990
2013-12-23 17:04:49serhiy.storchakasetmessages: +msg206869
2013-12-22 22:26:14Julian.Gindisetmessages: +msg206834
2013-12-11 21:56:36Julian.Gindisetfiles: +issue18983_v6.patch

messages: +msg205931
2013-12-11 20:29:34serhiy.storchakasetmessages: +msg205923
2013-12-11 20:28:05serhiy.storchakasetmessages: +msg205922
2013-12-11 18:57:12Julian.Gindisetmessages: +msg205914
2013-12-09 20:14:26Julian.Gindisetfiles: +issue18983_v5.patch

messages: +msg205738
2013-12-09 20:12:52serhiy.storchakasetmessages: +msg205737
2013-12-09 19:54:37Julian.Gindisetfiles: +issue18983_v5.patch

messages: +msg205736
2013-12-09 19:28:47Julian.Gindisetfiles: +issue18983_v4.patch

messages: +msg205731
2013-12-09 18:21:53serhiy.storchakasetmessages: +msg205723
2013-12-09 17:58:29Julian.Gindisetfiles: +issue18983_v3.patch

messages: +msg205720
2013-12-09 14:40:48Julian.Gindisetfiles: +issue18983_v2.patch

messages: +msg205697
2013-12-08 22:14:19ezio.melottisetnosy: +ezio.melotti
stage: needs patch -> patch review

versions: + Python 3.5, - Python 3.4
2013-12-08 22:13:05Julian.Gindisetmessages: +msg205612
2013-11-27 18:03:21Julian.Gindisetfiles: +issue18983.patch

messages: +msg204606
2013-11-26 22:33:40Julian.Gindisetfiles: +issue18983.patch

nosy: +Julian.Gindi
messages: +msg204541

keywords: +patch
2013-09-09 01:11:05jstasiaksetnosy: +jstasiak
messages: +msg197345
2013-09-08 22:36:32pitrousetnosy: +pitrou,tim.peters
messages: +msg197333
2013-09-08 21:15:56serhiy.storchakacreate
Supported byThe Python Software Foundation,
Powered byRoundup
Copyright © 1990-2022,Python Software Foundation
Legal Statements

[8]ページ先頭

©2009-2026 Movatter.jp