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 Arfrever, Keith.Dart, Michael.Felt,, christian.heimes, eric.araujo, hynek, kdart, knny-myer, martin.panter, methane, nailor, nvetoshkin, orsenthil, pitrou, r.david.murray, serhiy.storchaka, vstinner
Date 2017-09-28.22:04:48
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
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


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%) |


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 probably even better. My benchmark uses repeated import, it doesn't measure the "first time" import which was more expensive because of the "import ctypes".
Date User Action Args
2017-09-28 22:04:49vstinnersetrecipients: + vstinner, orsenthil, kdart, pitrou, christian.heimes, eric.araujo, Arfrever, r.david.murray, methane, nvetoshkin, knny-myer, nailor, Keith.Dart, hynek, martin.panter, serhiy.storchaka, Michael.Felt,
2017-09-28 22:04:49vstinnersetmessageid: <>
2017-09-28 22:04:49vstinnerlinkissue11063 messages
2017-09-28 22:04:48vstinnercreate