Lisp HUG Maillist Archive

de-cons'ing

I have a LWL program that appears to cons 100X more than I "expected" 
(according to (time ....)).

Am I correct in thinking that the only way to de-cons a program is by 
inspecting the code and running tests with (time ...)?

Are there any good tricks to thinking about this, to improve my gut-feel about 
where I could do less cons'ing?  

Am I missing some obvious use of a tool (e.g. profile) that will help me 
locate where I'm cons'ing?

thanx
pt


Re: de-cons'ing

I used "trace" (with appropriate options) to track down some unexpected 
memory allocations. It took me a while, though, to realize that "trace" 
itself was allocating memory! I tried to work around that by not doing too 
many nested traces, since the nesting made the numbers rise much more 
rapidly. (You might be able to use defadvice to build a similar mechanism 
that doesn't allocate...?)

In the end, other than some obvious consing, my memory allocation came 
down mostly to boxing floating-point numbers. I was able to reduce the 
boxing quite a bit, though obviously I couldn't eliminate it.

owner-lisp-hug@xanalys.com wrote on 05/11/2004 08:55:36 AM:

> I have a LWL program that appears to cons 100X more than I "expected" 
> (according to (time ....)).
> 
> Am I correct in thinking that the only way to de-cons a program is by 
> inspecting the code and running tests with (time ...)?
> 
> Are there any good tricks to thinking about this, to improve my
> gut-feel about 
> where I could do less cons'ing? 
> 
> Am I missing some obvious use of a tool (e.g. profile) that will help me 

> locate where I'm cons'ing?
> 
> thanx
> pt
> 


Updated at: 2020-12-10 08:56 UTC