STINNER Victor added the comment: Instead of using slow sysconfig and loading the big _sysconfig_data dictionary in memory, would it be possible to extract the minimum set of sysconfig needed by the site module and put it in a builtin module? In site.py, I only found 4 variables:
from sysconfig import get_config_var USER_BASE = get_config_var('userbase') from sysconfig import get_path USER_SITE = get_path('purelib', 'osx_framework_user') USER_SITE = get_path('purelib', '%s_user' % os.name) from sysconfig import get_config_var framework = get_config_var("PYTHONFRAMEWORK") Because of the site module, the _sysconfig_data module dictionary is always loaded in memory even for for a dummy print("Hello World!"). I suggest to start building a _site builtin module: subset of site.py which would avoid sysconfig and reimplement things in C for best performances. speed.python.org: * python_startup: 14 ms * python_startup_nosite: 8 ms Importing site takes 6 ms: 42% of 14 ms... I'm interested to know if it would be possible to reduce these 6 ms by rewriting some parts of site.py in C. ---------- nosy: +haypo _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue29585> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com