Author terry.reedy
Recipients brett.cannon, christian.heimes, gvanrossum, lukasz.langa, methane, rhettinger, serhiy.storchaka, terry.reedy, vstinner
Date 2017-10-03.16:37:29
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1507048650.15.0.213398074469.issue31415@psf.upfronthosting.co.za>
In-reply-to
Content
This is pretty useless on Windows because you are using a clock with 15-16 milli (not micro) second resolution on Windows.  Before Victor introduced time.perf_counter, with decent behavior on all systems, timeit used different time module functions on Windows and *nix because the two different functions had such different behavior on the two systems.  I believe it used time.clock on Windows (1 second resolution of *nix?) and time.time otherwise (.016 sec resolution on Windows).  

Time.monotonic seems to be based on time.time as it has the same low resolution on Windows.  Run something like

for i in range(1000): time.monotonic()

and you will see identical times except for 1 or 2 jumps of .016.  So the C equivalent or time.clock or time.perf_counter is needed on Windows.  Victor can advise as he knows this better than me.

An example of nearly useless output, with 15-16 millisecond resolution.

f:\dev\3x>python -X importtime -c "import idlelib.pyshell"
Running Debug|Win32 interpreter...
import time: self [us] | cumulative | imported package
import time:         0 |          0 |     _codecs
import time:         0 |          0 |   codecs
import time:         0 |          0 |   encodings.aliases
import time:     15000 |      15000 | encodings
import time:         0 |          0 | encodings.utf_8
import time:         0 |          0 | _signal
import time:         0 |          0 | encodings.latin_1
import time:         0 |          0 |     _weakrefset
import time:         0 |          0 |   abc
import time:         0 |          0 | io
import time:         0 |          0 |       _stat
import time:         0 |          0 |     stat
import time:         0 |          0 |       genericpath
import time:         0 |          0 |     ntpath
import time:         0 |          0 |     _collections_abc
import time:     16000 |      16000 |   os
import time:         0 |          0 |   _sitebuiltins
import time:         0 |          0 |   sitecustomize
import time:         0 |          0 |   usercustomize
import time:     16000 |      32000 | site
import time:         0 |          0 |   idlelib
import time:         0 |          0 |       types
import time:         0 |          0 |       _collections
import time:         0 |          0 |     enum
import time:     16000 |      16000 |     _tkinter
import time:         0 |          0 |     tkinter.constants
import time:         0 |          0 |         _sre
import time:         0 |          0 |           sre_constants
import time:         0 |          0 |         sre_parse
import time:         0 |          0 |       sre_compile
import time:         0 |          0 |         _functools
import time:         0 |          0 |             _operator
import time:         0 |          0 |           operator
import time:         0 |          0 |           keyword
import time:         0 |          0 |             _heapq
import time:         0 |          0 |           heapq
import time:         0 |          0 |           itertools
import time:     15000 |      15000 |           reprlib
import time:         0 |      15000 |         collections
import time:         0 |      15000 |       functools
import time:         0 |          0 |       _locale
import time:         0 |          0 |       copyreg
import time:     16000 |      31000 |     re
import time:         0 |      47000 |   tkinter
import time:         0 |          0 |     tkinter.commondialog
import time:     16000 |      16000 |   tkinter.messagebox
import time:         0 |          0 |           token
import time:         0 |          0 |         tokenize
import time:         0 |          0 |       linecache
import time:         0 |          0 |     traceback
import time:     15000 |      15000 |       __future__
import time:         0 |      15000 |     codeop
import time:         0 |      15000 |   code
import time:         0 |          0 |       time
import time:         0 |          0 |       signal
import time:         0 |          0 |       warnings
import time:         0 |          0 |       errno
import time:         0 |          0 |       threading
import time:         0 |          0 |       msvcrt
import time:         0 |          0 |       _winapi
import time:     16000 |      16000 |     subprocess
import time:     16000 |      32000 |   platform
import time:         0 |          0 |     _socket
import time:         0 |          0 |       collections.abc
import time:         0 |          0 |       math
import time:         0 |          0 |       select
import time:         0 |          0 |     selectors
import time:     15000 |      15000 |   socket
import time:     16000 |      16000 |       configparser
import time:         0 |          0 |       tkinter.font
import time:         0 |          0 |       _bootlocale
import time:         0 |          0 |       encodings.cp1252
import time:     31000 |      47000 |     idlelib.config
import time:         0 |          0 |     idlelib.delegator
import time:     63000 |     110000 |   idlelib.colorizer
import time:         0 |          0 |         posixpath
import time:         0 |          0 |       fnmatch
import time:         0 |          0 |           _ast
import time:     15000 |      15000 |         ast
import time:         0 |          0 |             _opcode
import time:         0 |          0 |           opcode
import time:         0 |          0 |         dis
import time:     16000 |      16000 |           importlib
import time:         0 |      16000 |         importlib.machinery
import time:         0 |      31000 |       inspect
import time:         0 |      31000 |     bdb
import time:         0 |          0 |     tkinter.ttk
import time:         0 |          0 |     idlelib.macosx
import time:         0 |          0 |     idlelib.scrolledlist
import time:         0 |          0 |     idlelib.windows
import time:         0 |      31000 |   idlelib.debugger
import time:     16000 |      16000 |   idlelib.debugger_r
import time:         0 |          0 |     importlib.abc
import time:         0 |          0 |       contextlib
import time:         0 |          0 |     importlib.util
import time:         0 |          0 |       _string
import time:     15000 |      15000 |     string
import time:         0 |          0 |       shlex
import time:         0 |          0 |         zlib
import time:         0 |          0 |           _compression
import time:         0 |          0 |           _bz2
import time:     16000 |      16000 |         bz2
import time:         0 |          0 |           _lzma
import time:         0 |          0 |         lzma
import time:         0 |          0 |         pwd
import time:         0 |          0 |         grp
import time:         0 |      16000 |       shutil
import time:         0 |      16000 |     webbrowser
import time:     15000 |      15000 |     tkinter.simpledialog
import time:         0 |          0 |       tkinter.colorchooser
import time:         0 |          0 |       idlelib.config_key
import time:         0 |          0 |           weakref
import time:         0 |          0 |               org
import time:         0 |          0 |             org.python
import time:         0 |          0 |           org.python.core
import time:         0 |          0 |         copy
import time:         0 |          0 |       idlelib.dynoption
import time:         0 |          0 |           tkinter.dialog
import time:     16000 |      16000 |         tkinter.filedialog
import time:         0 |      16000 |       idlelib.query
import time:         0 |          0 |       idlelib.tabbedpages
import time:         0 |          0 |       idlelib.textview
import time:         0 |          0 |           idlelib.multicall
import time:         0 |          0 |         idlelib.autocomplete_w
import time:         0 |          0 |           idlelib.pyparse
import time:     16000 |      16000 |         idlelib.hyperparser
import time:     15000 |      31000 |       idlelib.autocomplete
import time:         0 |          0 |       idlelib.codecontext
import time:         0 |          0 |       idlelib.parenmatch
import time:         0 |          0 |       idlelib.paragraph
import time:         0 |      47000 |     idlelib.configdialog
import time:         0 |          0 |       idlelib.searchbase
import time:         0 |          0 |       idlelib.searchengine
import time:         0 |          0 |     idlelib.grep
import time:     16000 |      16000 |           html.entities
import time:         0 |      16000 |         html
import time:         0 |          0 |         _markupbase
import time:     16000 |      32000 |       html.parser
import time:         0 |      32000 |     idlelib.help
import time:         0 |          0 |     idlelib.help_about
import time:         0 |          0 |     idlelib.replace
import time:         0 |          0 |     idlelib.search
import time:         0 |          0 |       idlelib.redirector
import time:         0 |          0 |     idlelib.percolator
import time:     15000 |      15000 |     idlelib.undo
import time:         0 |          0 |             _hashlib
import time:         0 |          0 |             _blake2
import time:         0 |          0 |             _sha3
import time:         0 |          0 |           hashlib
import time:         0 |          0 |             _bisect
import time:         0 |          0 |           bisect
import time:         0 |          0 |           _random
import time:         0 |          0 |         random
import time:         0 |          0 |       tempfile
import time:     16000 |      16000 |       locale
import time:         0 |      16000 |     idlelib.iomenu
import time:         0 |          0 |     idlelib.mainmenu
import time:         0 |          0 |     idlelib.statusbar
import time:         0 |          0 |     idlelib.autoexpand
import time:     15000 |      15000 |       textwrap
import time:         0 |          0 |       idlelib.calltip_w
import time:         0 |      15000 |     idlelib.calltips
import time:         0 |          0 |     idlelib.rstrip
import time:         0 |          0 |     idlelib.zoomheight
import time:         0 |     171000 |   idlelib.editor
import time:         0 |          0 |   idlelib.filelist
import time:         0 |          0 |   idlelib.outwin
import time:         0 |          0 |         _struct
import time:         0 |          0 |       struct
import time:         0 |          0 |       _compat_pickle
import time:         0 |          0 |           org
import time:         0 |          0 |         org.python
import time:         0 |          0 |       org.python.core
import time:         0 |          0 |       _pickle
import time:         0 |          0 |     pickle
import time:         0 |          0 |     queue
import time:     16000 |      16000 |     socketserver
import time:     16000 |      32000 |   idlelib.rpc
import time:         0 |          0 |     idlelib.debugobj_r
import time:         0 |          0 |         idlelib.tree
import time:         0 |          0 |       idlelib.debugobj
import time:         0 |          0 |     idlelib.stackviewer
import time:         0 |          0 |   idlelib.run
import time:         0 |          0 |   idlelib.history
import time:     30000 |     515000 | idlelib.pyshell
History
Date User Action Args
2017-10-03 16:37:30terry.reedysetrecipients: + terry.reedy, gvanrossum, brett.cannon, rhettinger, vstinner, christian.heimes, methane, lukasz.langa, serhiy.storchaka
2017-10-03 16:37:30terry.reedysetmessageid: <1507048650.15.0.213398074469.issue31415@psf.upfronthosting.co.za>
2017-10-03 16:37:30terry.reedylinkissue31415 messages
2017-10-03 16:37:29terry.reedycreate