Jakub Stasiak <jakub+python....@stasiak.at> added the comment:

Yurii, I don't believe that benchmark measures what you need to measure (once 
imported module is kept imported forever until unloaded, so successive imports 
are no-ops).

See how the side effects of importing bbb only happen once: 

% cat bbb.py 
import time
time.sleep(1)
with open('bbb.log', 'a') as f:
    written = f.write('hello\n')
    assert written == 6

% time python -m timeit "import bbb"
1 loop, best of 5: 515 nsec per loop
python -m timeit "import bbb"  0.03s user 0.01s system 4% cpu 1.050 total

% cat bbb.log 
hello

----------

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

Reply via email to