[Pythonmac-SIG] Slow module loading revisited

Robin Dunn robin at alldunn.com
Wed Oct 15 20:49:59 EDT 2003

Hi all,

Morgen and I spent a bunch of time today trying to figure out what is 
taking all the time when the wxPython extension module is being imported 
with MacPython-OSX.  We've done some ktrace/kdumping and just like in a 
thread on Pythonmac-SIG from February[1] we are seeing about a six 
second delay just before HIToolbox is open()ed, although it was not 
after libcrypto in our case.  (HIToolbox was also loaded a couple 
seconds before the delay with load_shared_file()...)

We then set DYLD_TRACE and I wrote a script to decode the function calls 
it adds to a ktrace listing.  It seems that there are many thousands of 
symbols that are being handled by dyld during  that 6 second block of 
time (now expanded out to about 30 seconds because of all the logging.) 
  Dyld is doing something (probably relocating/rebinding) with all those 
symbols at that time as we had supposed, but the surprise was that the 
wxWindows symbols are a very small fraction of the time, only about 7%. 
  The bulk of the rest of the time is spent on what looks like Carbon 
symbols (at least I recognise a lot of them as Carbon APIs, the rest 
look like they might be internal stuff that the Carbon APIs themselves 

As in [3] Morgen has tried rebuilding both Python and libwx_mac with and 
without prebinding, with no apparent change in the startup delay.  Has 
there been any further enlightenment on this subject since February?  Is 
the standard MacPython-OSX downloadable from Jack's page now built with 
or without prebinding?  Any suggestions?


Robin Dunn
Software Craftsman
http://wxPython.org  Java give you jitters?  Relax with wxPython!

More information about the Pythonmac-SIG mailing list