On Aug 20, 2009, at 5:46 PM, Eric Gouriou wrote:
To get a better idea of how long the dynamic linking takes, I recommend using DYLD_PRINT_STATISTICS
I ran with extra dyld options to print libraries loaded as well as initializers and got plenty of information [1].
The statistics are as follows:
total time: 1.3 seconds (100.0%)
total images loaded: 106 (93 from dyld shared cache, 56 needed no fixups)
total segments mapped: 49, into 5894 pages with 684 pages pre-fetched
total images loading time: 328.8 milliseconds (24.1%)
total rebase fixups: 148,829
total rebase fixups time: 4.0 milliseconds (0.2%)
total binding fixups: 24,863
total binding symbol lookups: 796, average images searched per symbol: 2.3
total binding fixups time: 112.2 milliseconds (8.2%)
total bindings lazily fixed up: 45 of 19,103
total init time time: 919.3 milliseconds (67.3%)
total images with weak exports: 3
It seems that the binding fixup time can be discounted (8.2%). I think the image loading time (24.1%) and total initialization time (67.3%) can be improved upon, though.
Do initializers go into total init time?