On 4/25/07, Jonathan Worthington <[EMAIL PROTECTED]> wrote:
Andy Dougherty wrote:
> 2.  Garbage collection really slows the program down (I observed factors of 
10 difference in speed with and without -G), and I have a vague unsupported 
suspicion that the slowdown grows faster than linearly with the allocated memory.
>
I remember tracing through a load of this code for about an hour. I was
none the wiser afterwards, but I was trying to work out arenas and
allocation stuff and so on.

Basically, if you run the program without -G and then break it, it will
usually break inside the GC routine. What I do remember is that it was
looping through some kinda memory pool, or arena, or whatever. However,
the thing it was looping through was *huge* (like, from 0 to a six
figure number) and I think it maybe was an n^2 algorithm, which
amplified the effect further.

Recent mentions of a lack of memory pool compaction kinda resonates with
what I analyzed; I always meant to return to look a bit more, but never
had time to dig deeper. I think re-discovering where it's spending so
much time during GC would be a good start, though. And just randomly
breaking into the program did it for me, usually first time.

yep, in src/gc/dod.c, i end up inside Parrot_dod_sweep()
cur_arena->used is 137910 at present, which is where i broke in at test 177.

there's a loop that looks like:

       for (i = nm = 0; i < cur_arena->used; i++) {
           if (PObj_on_free_list_TEST(b))
               ; /* if it's on free list, do nothing */
           else if (PObj_live_TEST(b)) {
               total_used++;
               PObj_live_CLEAR(b);
               PObj_get_FLAGS(b) &= ~PObj_custom_GC_FLAG;
           }
           else {
               /* it must be dead */

i set a breakpoint at
               total_used++;

the first time this line is executed is when i = 134459 -- that's the
first live object. that seems odd. when i get up around 137700, just
about every object is live.

and that is just for one arena. counting through the chain of
cur_arena->prev, it seems there are ten arenas. i'm in over my head
here--but it seems to me that both this chain of arenas and the size
of each is much bigger than i imagine it should be.
~jerry

Reply via email to