Author vstinner
Recipients ethan.furman, gvanrossum, ned.deily, vstinner
Date 2016-11-07.23:38:35
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1478561915.6.0.220678128256.issue28637@psf.upfronthosting.co.za>
In-reply-to
Content
Oh, I understood why I had issues to reproduce the startup performance slowdown. When Python is run from the source code using ./python, the re module is not imported. When Python is installed, the re is not imported by default neither:

haypo@speed-python$ prefix/bin/python3 -c 'import sys; print("re" in sys.modules)'
False


BUT when Python is started from a virtual environment (created by the "venv" module), the re module is important by default.

haypo@speed-python$ venv/bin/python3 -c 'import sys; print("re" in sys.modules)'
True


If the site module is not imported, the re module is not imported:

haypo@speed-python$ venv/bin/python3 -S -c 'import sys; print("re" in sys.modules)'
False


The /home/haypo/benchmarks/prefix/lib/python3.6/site.py file is generated by the venv module and contains:

def venv(...):
    ...
    if candidate_confs:
        import re
        config_line = re.compile(CONFIG_LINE)
        ...
History
Date User Action Args
2016-11-07 23:38:35vstinnersetrecipients: + vstinner, gvanrossum, ned.deily, ethan.furman
2016-11-07 23:38:35vstinnersetmessageid: <1478561915.6.0.220678128256.issue28637@psf.upfronthosting.co.za>
2016-11-07 23:38:35vstinnerlinkissue28637 messages
2016-11-07 23:38:35vstinnercreate