Author jstasiak
Recipients Mark.Shannon, corona10, jstasiak, methane, serhiy.storchaka, uriyyo
Date 2020-11-17.16:47:32
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1605631652.56.0.476480776167.issue42202@roundup.psfhosted.org>
In-reply-to
Content
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
History
Date User Action Args
2020-11-17 16:47:32jstasiaksetrecipients: + jstasiak, methane, Mark.Shannon, serhiy.storchaka, corona10, uriyyo
2020-11-17 16:47:32jstasiaksetmessageid: <1605631652.56.0.476480776167.issue42202@roundup.psfhosted.org>
2020-11-17 16:47:32jstasiaklinkissue42202 messages
2020-11-17 16:47:32jstasiakcreate