Re: what happens before main()?

Sherm Pendley <[email protected]> Tue, 27 Apr 2010 11:09:31 -0400
Newsgroups gmane.comp.macosx.devel
Message-ID <[email protected]>
On Tue, Apr 27, 2010 at 5:59 AM, Aya Koshigaya <[email protected]> wrote:
>
> I have a big library written in C++, in this lib there are several static-things that get initialised at the start of the Programm, even before the main() function is called.
>
> So far so good, but the problem is - the program takes some time to start, and when I did some time-trackings to see where the time goes, I found out it takes already up to 3 seconds until my main() function is called.
>
> But, since there are about 300-400 Files it would take forever to find the "bad" statics.. so, is there any way in Xcode to step trough the initialisation process? Like as if I'd put a breakpoint in the main() function and step forward.. but in the main method it's already to late :(

I would try short-circuiting main() by adding a "return 0" at the top,
then profiling what's left with Shark or Instruments. That should give
you a report of not only what constructors are being called, but also
which ones are the major time sinks.

sherm--

-- 
Cocoa programming in Perl:
http://www.camelbones.org