[Python-Dev] Peculiar import code in pickle.py

Nick Coghlan ncoghlan at gmail.com
Wed Jul 14 14:15:43 CEST 2010


On Wed, Jul 14, 2010 at 9:05 PM, Steve Holden <steve at holdenweb.com> wrote:
>> I have stopped fixing bugs related to this in import.c because of the
>> annoying issues it causes and I expect the correct approach to gain
>> traction at some point (plus get importlib bootstrapped in so I don't
>> have to care about import.c anymore).
>>
> It's only a matter of time until someone decides to provide a C
> implementation of importlib ;-)

A C accelerated version of importlib would probably be an awful lot
cleaner than the current import implementation. While the import code
isn't quite the mess that we sometimes make it out to be (it does
basically work after all, and most of the "problems" lie in dim dark
corners that 99% of developers will never get close to), but it has
definitely suffered from an accumulation of features on top of a core
approach that has been pushed far beyond what it was originally
designed to support.

That said, I believe the limiting factor in import speed is likely to
remain the number of stat calls and other filesystem operations, so it
will be interesting to find out just how significant a slowdown there
is between import.c and importlib. If I'm right about the real source
of bottlenecks in import performance, the difference may be
surprisingly small.

Cheers,
Nick.

-- 
Nick Coghlan   |   ncoghlan at gmail.com   |   Brisbane, Australia


More information about the Python-Dev mailing list