[Python-Dev] Timing breakdown of Py_InitializeEx_Private()

Christian Tismer tismer at stackless.com
Wed Apr 16 09:39:34 CEST 2014


Not trying to argue about Mercurial, but if a major amount
of startup time is spent in site.py:

I think in cases like hg command line scripts there is no need
to import site just for hg scripts.

Maybe that would improve things if those startup scripts avoid importing
site? Or do they, already?

cheers - chris


On 16.04.14 04:35, Guido van Rossum wrote:
> Well, that's the part that does "import site". Anything that speeds up
> the code in Lib/site.py might help. :-)
>
>
> On Tue, Apr 15, 2014 at 5:23 PM, Terry Reedy <tjreedy at udel.edu
> <mailto:tjreedy at udel.edu>> wrote:
>
>     On 4/15/2014 5:26 PM, Brett Cannon wrote:
>
>         To finish my timing work I decided to see
>         where Py_InitializeEx_Private() spends its time. The following
>         is a
>         breakdown measured in microseconds running using -E:
>
>         INIT:
>         setlocale: 11
>         envvar: 2
>         random init: 2
>         interp creation: 15
>         thread creation: 6
>         GIL: 10
>         _Py_ReadyTypes(): 930
>         more types: 44
>         builtins: 141
>         exceptions: 287
>         sys: 258
>         _PyImport_Init: 15
>         import hooks: 4
>         _PyWarnings_Init(): 15
>         ENTERING import_init():
>            PyImport_ImportFrozenModule(_frozen_importlib): 1186
>            interp->importlib: 6
>            PyInit_imp(): 15
>            _imp: 3
>            importlib._install(): 876
>            _PyImportZip_Init(): 130
>         _PyFaulthandler_Init(): 13
>         time: 3
>         ENTERING initfsencoding():
>            codec lookup: 2179
>         signals: 120
>         tracemalloc: 7
>         __main__: 13
>         initstdio(): 1568
>         warnings module: 4
>         initsite(): 9552
>
>
>     It looks like initsite takes half the time. Can it be sped up?
>
>
>     -- 
>     Terry Jan Reedy
>
>
>     _______________________________________________
>     Python-Dev mailing list
>     Python-Dev at python.org <mailto:Python-Dev at python.org>
>     https://mail.python.org/mailman/listinfo/python-dev
>     Unsubscribe:
>     https://mail.python.org/mailman/options/python-dev/guido%40python.org
>
>
>
>
> -- 
> --Guido van Rossum (python.org/~guido <http://python.org/%7Eguido>)
>
>
> _______________________________________________
> Python-Dev mailing list
> Python-Dev at python.org
> https://mail.python.org/mailman/listinfo/python-dev
> Unsubscribe: https://mail.python.org/mailman/options/python-dev/tismer%40stackless.com


-- 
Christian Tismer             :^)   <mailto:tismer at stackless.com>
Software Consulting          :     Have a break! Take a ride on Python's
Karl-Liebknecht-Str. 121     :    *Starship* http://starship.python.net/
14482 Potsdam                :     PGP key -> http://pgp.uni-mainz.de
phone +49 173 24 18 776  fax +49 (30) 700143-0023
PGP 0x57F3BF04       9064 F4E1 D754 C2FF 1619  305B C09C 5A3B 57F3 BF04
      whom do you want to sponsor today?   http://www.stackless.com/

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-dev/attachments/20140416/a86d7e77/attachment.html>


More information about the Python-Dev mailing list