guile-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: expensive backtraces.


From: Lynn Winebarger
Subject: Re: expensive backtraces.
Date: Sat, 15 Feb 2003 14:49:33 -0500

On Saturday 15 February 2003 13:41, Han-Wen Nienhuys wrote:
> 
> and the rest, is approximately 8 seconds.  I think this is exorbitant
> on a 400mhz machine.  When tracing this with GDB, it seems that a lot
> of memory is filled and GC-ed again for printing enormous structures,
> which are later folded into '#' marks again.
>  [...]
> Other than trimming my "print_smob()" routines, does anyone see a
> solution to this problem from the GUILE side? Ideally, the printing of
> a large structure should be interrupted once the length of its output
> exceeds a certain size. It seems that right now, first the entire
> object is printed (taking a lot of time), and then all that printout
> is replaced by "#" if too large.
> 

    There is a standard solution.  First keep track of how deep in the
structure you are and allow (not require) a limit on the recursion depth.
The second is to then notice that lists should be treated like arrays
and not as nested datastructures, and allow a limit on the length of both
of them.  
   If you try to determine both those limits to constrain the actual total
output length, you will find yourself backtracking.
   There's also now an extra bit in cons cells that could be used to tell
if the printer has seen it already.  Or not.  It's not clear some better
use wouldn't come along.

Lynn





reply via email to

[Prev in Thread] Current Thread [Next in Thread]