[Python-checkins] cpython (merge 3.4 -> default): #18588: merge with 3.4.
ezio.melotti
python-checkins at python.org
Mon Aug 4 16:02:11 CEST 2014
http://hg.python.org/cpython/rev/45b208ae9eab
changeset: 91991:45b208ae9eab
parent: 91989:a64806257119
parent: 91990:c39457a07caa
user: Ezio Melotti <ezio.melotti at gmail.com>
date: Mon Aug 04 17:01:48 2014 +0300
summary:
#18588: merge with 3.4.
files:
Doc/library/timeit.rst | 19 ++++++++++---------
1 files changed, 10 insertions(+), 9 deletions(-)
diff --git a/Doc/library/timeit.rst b/Doc/library/timeit.rst
--- a/Doc/library/timeit.rst
+++ b/Doc/library/timeit.rst
@@ -28,22 +28,23 @@
.. code-block:: sh
- $ python -m timeit '"-".join(str(n) for n in range(100))'
- 10000 loops, best of 3: 40.3 usec per loop
- $ python -m timeit '"-".join([str(n) for n in range(100)])'
- 10000 loops, best of 3: 33.4 usec per loop
- $ python -m timeit '"-".join(map(str, range(100)))'
- 10000 loops, best of 3: 25.2 usec per loop
+ $ python3 -m timeit '"-".join(str(n) for n in range(100))'
+ 10000 loops, best of 3: 30.2 usec per loop
+ $ python3 -m timeit '"-".join([str(n) for n in range(100)])'
+ 10000 loops, best of 3: 27.5 usec per loop
+ $ python3 -m timeit '"-".join(map(str, range(100)))'
+ 10000 loops, best of 3: 23.2 usec per loop
This can be achieved from the :ref:`python-interface` with::
>>> import timeit
>>> timeit.timeit('"-".join(str(n) for n in range(100))', number=10000)
- 0.8187260627746582
+ 0.3018611848820001
>>> timeit.timeit('"-".join([str(n) for n in range(100)])', number=10000)
- 0.7288308143615723
+ 0.2727368790656328
>>> timeit.timeit('"-".join(map(str, range(100)))', number=10000)
- 0.5858950614929199
+ 0.23702679807320237
+
Note however that :mod:`timeit` will automatically determine the number of
repetitions only when the command-line interface is used. In the
--
Repository URL: http://hg.python.org/cpython
More information about the Python-checkins
mailing list