"Thomas F. Burdick" <[EMAIL PROTECTED]> writes:
> Edi Weitz writes:
>
> > OK, some more details I can provide:
> >
> > 1. I don't concatenate a string when calling SCAN. This can happen but
> > it doesn't happen with my test parameters. So actually I only
> > generate two arrays.
>
> Well, that would probably be your consing.
OK, then my assumption that 'consing' specifically meant creating
conses was wrong. I guess I have to live with that in this case 'cause
I can't get rid of the arrays.
> > 2. On closer inspection I observed that after succesive calls to (TEST
> > N) with N=100 - i.e. 100 invocations of my SCAN function - I
> > _sometimes_ get '8184 bytes consed' but most of the time it is '0
> > bytes consed'. With bigger N the amount of bytes consed as reported
> > is proportional to N.
>
> I'm guessing you're on x86?
Yep.
> Don't trust the reported bytes consed to be precise (but it is
> accurate). For large N, look at the change in bytes consed, as N
> increases. Do you generate two arrays in the whole test, or per
> iteration? If it's the latter, then you should expect the number of
> bytes consed to scale appropriately. If it's the former, and the
> number of bytes consed scales linearly, then you might be consing
> closures.
I generate two arrays per iteration, the closures are generated only
once. It looks like the results are what I'd have to expect from your
description. (And it also looks like Nicolas' description about how
CMUCL reports GC was right.)
> If you are, especially if they're short-lived, it might not be
> anything to worry about -- after all, x86 does have a generational
> GC, so it should collect your short-lived garbage gracefully. Look
> at the amount of time spent in GC, and if it's a low enough
> percentage, I wouldn't worry about it unless profiling shows that
> you really need to. After all, if your consing is linear to N, it
> will produce GC time that grows linearly, which won't increase the
> algorithmic complexity of your solution.
Yes, it's beginning to make sense. I began to worry that GC took about
10% percent of my time for large N but now after reading the answers
and running several other tests I see that
- consing is linear to N,
- 10% percent hold only for my easy test problems, for real problems
the GC time percentage tends to be a lot smaller, 2% or less.
OK, mumble, mumble, I think I could have found out this myself had I
though about it a little bit more... shame on me.
Thanks to all who replied!
Edi.