[Pythonmac-SIG] Slow loading of modules

Jack Jansen Jack.Jansen@oratrix.com
Sat, 22 Feb 2003 01:00:34 +0100


After playing around with DYLD_PRINT_LIBRARIES a bit (setting this 
environment variable causes the dynamic loader to print out library 
names as it loads them) I get the impression that I've found the 
slowdown. It appears that HIToolbox is the main culprit: the first 
module loading that will stall for approximately 8 seconds on my 400Mhz 
G3.

However, HIToolbox by itself doesn't seem to be the problem. I created 
a minimal C program that calls SysBeep, and it finished immediately. 
So, either there's something tricky about using HIToolbox from 
dynamically loaded code or we're doing something stupid in the way we 
link to HIToolbox or it has to do with the prebinding or...

Just for fun, I modified the Python main program to call SysBeep(), and 
this significantly lowered the time used. With SysBeep hack:
% time ./python.exe -c "import Carbon.AE"
5.640u 0.120s 0:05.99 96.1%     0+0k 0+8io 0pf+0w

Without SysBeep hack:
% time ./python.exe -c "import Carbon.AE"
8.870u 0.240s 0:09.32 97.7%     0+0k 0+0io 0pf+0w


Any suggestions are welcome,
--
- Jack Jansen        <Jack.Jansen@oratrix.com>        
http://www.cwi.nl/~jack -
- If I can't dance I don't want to be part of your revolution -- Emma 
Goldman -