guile-devel
[Top][All Lists]
Advanced

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

Re: [Patch] Re-implement srfi-1 partition in C to avoid stack overflow


From: Matthias Koeppe
Subject: Re: [Patch] Re-implement srfi-1 partition in C to avoid stack overflow
Date: Thu, 10 Jul 2003 15:59:26 +0200
User-agent: Gnus/5.090004 (Oort Gnus v0.04) Emacs/21.3.50 (sparc-sun-solaris2.8)

Kevin Ryde <address@hidden> writes:

> Matthias Koeppe <address@hidden> writes:
>>
>> +   /* In this implementation, the output lists don't share memory with
>> +      list, because it's probably not worth the effort. */
>
> It might be nice to share everywhere it's permitted, if you could be
> bothered.  (The non-tail recursion you're fixing is clearly the worst
> problem though.)

I decided against implementing the sharing of structure because:

1) It has a performance penalty because parts of the list need to be
   traversed twice.

2) The savings by the sharing of structure are "unpredictable", as it
   depends on the order of the input elements.  There could only be
   savings if there is a long list tail of elements that go into one
   of the output lists, which I think is an "unlikely" case.

On the other hand, it would be worthwhile to implement partition! so
that it re-uses the cons cells of the input list.  However, I don't
have time to work on it.

-- 
Matthias Köppe -- http://www.math.uni-magdeburg.de/~mkoeppe




reply via email to

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