STINNER Victor added the comment: 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) ... ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue28637> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com