[Mono-dev] Re: GC startup time on windows (in DllMain)
aras at otee.dk
Thu Mar 2 04:58:11 EST 2006
> When profiling our startup times on Windows, I noticed that GC_init
> takes quite long (~1.5 seconds on P4 3GHz), called from DllMain.
I've investigated the startup time more. Basically, I can cut mono
startup time by ~1 second on my 3 GHz machine, and everything still
seems to work :)
GC startup time did not look like it's a SMP issue - DllMain called
GC_init, which called GC_init_inner which has code like:
if (!GC_dont_precollect || GC_incremental) GC_gcollect_inner();
And this first collection seems to walk over memory, find out which
memory can be read and which can't, etc. etc. On my machine it does
~5000 calls to GC_mark_from, each of them being a millisecond or less,
but all the calls add up.
Now, one could set GC_dont_precollect to be one (it is zero by
default), and the comments at gc.h seem to say that you can do this if
you're building the root set yourself - which I think mono does.
Long story short, just not calling GC_collect_inner from GC_init_inner
still makes all the code we have work, and cuts the startup time
Is there some serious reason for GC pre-collecting everything on startup?
More information about the Mono-devel-list