Author vstinner
Recipients methane, vstinner
Date 2017-02-17.10:20:34
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1487326836.03.0.208565963669.issue29585@psf.upfronthosting.co.za>
In-reply-to
Content
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.
History
Date User Action Args
2017-02-17 10:20:36vstinnersetrecipients: + vstinner, methane
2017-02-17 10:20:36vstinnersetmessageid: <1487326836.03.0.208565963669.issue29585@psf.upfronthosting.co.za>
2017-02-17 10:20:36vstinnerlinkissue29585 messages
2017-02-17 10:20:34vstinnercreate