Author vstinner
Recipients methane, vstinner
Date 2017-02-17.10:20:34
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
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, 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' %

            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 which would avoid sysconfig and reimplement things in C for best performances.
* 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 in C.
Date User Action Args
2017-02-17 10:20:36vstinnersetrecipients: + vstinner, methane
2017-02-17 10:20:36vstinnersetmessageid: <>
2017-02-17 10:20:36vstinnerlinkissue29585 messages
2017-02-17 10:20:34vstinnercreate