This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author vstinner
Recipients christian.heimes, lemburg, methane, vstinner
Date 2017-02-17.12:06:23
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <CAMpsgwYcpsu-TO1s1_8H5wSYfR23BHVJn9Go1APsfrs5YNe4dw@mail.gmail.com>
In-reply-to <1487331959.6.0.49591003398.issue29585@psf.upfronthosting.co.za>
Content
Marc-Andre Lemburg added the comment:
> I don't think rewriting party of site.py in C is a good idea. It's a rather maintenance intense module.
>
> However, optimizing access is certainly something that's possible, e.g. by placing the few variables that are actually needed by site.py into a bootstrap module for sysconfig, which only contains the few variables needed by interpreter startup.

Right, I don't propose to rewrite the 598 lines of site.py in C, but
only rewrite the parts which have a huge impact on the startup time.
It seems like the minimum part would be to write a _site module which
provide the 4 variables currently read from sysconfig.

I'm proposing to add a new private module because I don't want to
pollute site which already contains too many things.

I looked at site.py history: I don't see *major* changes last 2 years.
Only small enhancements, updates and fixes.

> Alternatively, sysconfig data could be made available via a C lookup function; with the complete dictionary only being created on demand. get_config_var() already is such a lookup API which could be used as front-end.

I don't think that it's worth it to reimplement partially sysconfig in
C. This module is huge, complex, and platform dependant.

Well, I'm not sure about what is the best approach, but I'm sure that
we can do something to optimize site.py. 6 ms is a lot!

I never liked site.py. It seems like a huge workaround. I also dislike
having a different behaviour if site is imported or not.

That's why I asked Steve Dower to removing the code to create the
cpXXX alias for the mbcs codec from site.py to encodings/__init__.py:
see commit f5aba58480bb0dd45181f609487ac2ecfcc98673. I'm happy that
this code was removed from site.py!
History
Date User Action Args
2017-02-17 12:06:23vstinnersetrecipients: + vstinner, lemburg, christian.heimes, methane
2017-02-17 12:06:23vstinnerlinkissue29585 messages
2017-02-17 12:06:23vstinnercreate