Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
cpython
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
cpython
Commits
b398d3e4
Kaydet (Commit)
b398d3e4
authored
Agu 04, 2014
tarafından
Ezio Melotti
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Sade Fark
#18588: merge with 3.4.
üst
f5b18216
591176e5
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
9 deletions
+10
-9
timeit.rst
Doc/library/timeit.rst
+10
-9
No files found.
Doc/library/timeit.rst
Dosyayı görüntüle @
b398d3e4
...
...
@@ -28,22 +28,23 @@ can be used to compare three different expressions:
.. 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: 2
5
.2 usec per loop
$ python
3
-m timeit '"-".join(str(n) for n in range(100))'
10000 loops, best of 3:
30.2
usec per loop
$ python
3
-m timeit '"-".join([str(n) for n in range(100)])'
10000 loops, best of 3:
27.5
usec per loop
$ python
3
-m timeit '"-".join(map(str, range(100)))'
10000 loops, best of 3: 2
3
.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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment