[Python-Dev] Python startup time

Benjamin Peterson benjamin at python.org
Thu Oct 10 16:26:25 CEST 2013


2013/10/9 Antoine Pitrou <solipsis at pitrou.net>:
> Le Wed, 9 Oct 2013 10:29:30 +0200,
> Antoine Pitrou <solipsis at pitrou.net> a écrit :
>> Le Tue, 8 Oct 2013 15:43:40 -0400,
>> Benjamin Peterson <benjamin at python.org> a écrit :
>>
>> > 2013/10/8 R. David Murray <rdmurray at bitdance.com>:
>> > > In this context, if we'd been *really* smart-lazy in CPython
>> > > development, we'd have kept the memory and startup-time
>> > > and...well, we probably do pretty well on CPU actually...smaller,
>> > > so that when smartphones came along Python would have been the
>> > > first high level language used on them, because it fit.  Then
>> > > we'd all be able to be *much* lazier now :)
>> >
>> > Even on desktop, startup time leaves a lot to be desired.
>>
>> That's true. Anyone have any ideas to improve it?
>
> It's difficult to identify significant contributors but some possible
> factors:
> - marshal.loads() has become twice slower in 3.x (compared to 2.7)
> - instantiating a class is slow (type('foo', (), {}) takes around 25ms
>   here)

Do you mean microsecond?

 $ ./python -m timeit "type('foo', (), {})"
10000 loops, best of 3: 25.9 usec per loop


-- 
Regards,
Benjamin


More information about the Python-Dev mailing list