This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author vstinner
Recipients barry, benjamin.peterson, davin, lukasz.langa, methane, nascheme, pitrou, rhettinger, tim.peters, vstinner, yselivanov
Date 2017-09-28.22:03:48
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1506636229.01.0.466225441844.issue31558@psf.upfronthosting.co.za>
In-reply-to
Content
I ran two benchmarks on my Fedora 26.

* new = master (commit a106aec2ed6ba171838ca7e6ba43c4e722bbecd1)
* ref = commit 8d59aca4a953b097a9b02b0ecafef840e4ac5855

git co master
./python -m perf timeit -s 'import sys, uuid' "del sys.modules['uuid']; import uuid; uuid = None" --inherit=PYTHONPATH -v -o import_new.json
./python -m perf timeit -s 'import uuid; u=uuid.uuid1' "u()" --inherit=PYTHONPATH -v -o uuid1_new.json

git co 8d59aca4a953b097a9b02b0ecafef840e4ac5855
./python -m perf timeit -s 'import uuid; u=uuid.uuid1' "u()" --inherit=PYTHONPATH -v -o uuid1_ref.json
./python -m perf timeit -s 'import sys, uuid' "del sys.modules['uuid']; import uuid; uuid = None" --inherit=PYTHONPATH -v -o import_ref.json

Import:

haypo@selma$ ./python -m perf compare_to import_ref.json import_new.json --table
+-----------+------------+-----------------------------+
| Benchmark | import_ref | import_new                  |
+===========+============+=============================+
| timeit    | 4.04 ms    | 430 us: 9.39x faster (-89%) |
+-----------+------------+-----------------------------+

uuid.uuid1():

haypo@selma$ ./python -m perf compare_to uuid1_ref.json uuid1_new.json --table
+-----------+-----------+------------------------------+
| Benchmark | uuid1_ref | uuid1_new                    |
+===========+===========+==============================+
| timeit    | 18.9 us   | 15.2 us: 1.24x faster (-20%) |
+-----------+-----------+------------------------------+

Everything is faster. The import time is 9.4x faster, nice! In practice, the import time is even better since my benchmark uses repeated import, it doesn't measure the "first time" import which was more expensive using "import ctypes" previously.
History
Date User Action Args
2017-09-28 22:05:02vstinnerunlinkissue31558 messages
2017-09-28 22:03:49vstinnersetrecipients: + vstinner, tim.peters, barry, nascheme, rhettinger, pitrou, benjamin.peterson, methane, lukasz.langa, yselivanov, davin
2017-09-28 22:03:49vstinnersetmessageid: <1506636229.01.0.466225441844.issue31558@psf.upfronthosting.co.za>
2017-09-28 22:03:49vstinnerlinkissue31558 messages
2017-09-28 22:03:48vstinnercreate