STINNER Victor <victor.stin...@gmail.com> added the comment:

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.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue31558>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to