[Python-Dev] Strange import behaviour, recently introduced
Thomas Heller
thomas.heller@ion-tof.com
Wed, 21 Feb 2001 17:39:09 +0100
Jack Jansen wrote:
> I'm running into strange problems with import in frozen Mac programs.
>
> On the Mac a program is frozen in a rather different way from how it happens
> on Unix/Windows: basically all .pyc files are stuffed into resources, and if
> the import code comes across a file on sys.path it will look for PYC resources
> in that file. So, you freeze a program by stuffing all your modules into the
> interpreter executable as PYC resources and setting sys.path to contain only
> the executable file, basically.
>
> This week I noticed that these resource imports have suddenly become very very
> slow. Whereas startup time of my application used to be around 2 seconds
> (where the non-frozen version took 6 seconds) it now takes almost 20 times as
> long. The non-frozen version still takes 6 seconds.
>
The most recent version calls PyImport_ImportModuleEx() for '__builtin__'
for every import of __builtin__ without caching the result in a static variable.
Can this be the cause?
Thomas Heller