guile-user
[Top][All Lists]
Advanced

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

Re: string vs list processing


From: Martin Grabmueller
Subject: Re: string vs list processing
Date: Tue, 17 Apr 2001 16:49:30 +0200

> From: address@hidden (Bill Gribble)
> Date: Mon, 16 Apr 2001 08:36:04 -0500
> 
> On Mon, Apr 16, 2001 at 02:59:15PM +0200, Sascha Ziemann wrote:
> > Any suggestions for a HTTP replay? ;-)
> 
> Be smart about when you call string operations.  In Gnucash, we use
> guile to assemble multi-megabyte HTML documents.  You can't go around
> string-appending every "<" to "p>" to construct this size string; the
> garbage you generate is ridiculous.  You will get much better
> performance if you cons up a list of component strings, reverse it at
> the end, and apply string-append to the whole list.

This is what the procedure `reverse-string-concatenate' in SRFI-13 is
for.  It takes a list of strings, reverses it and creates a new string
by concatenating the elements of the string list.

<advertise>
If you want that to be fast, check out my SRFI-13 (string library)
implementation, where a call to `reverse-string-concatenate' only
costs you two traversals over the list, one malloc() and one memcpy()
of each element string.  I think this is as fast as you can get.

http://www.pintus.de/mgrabmue/guile/guile.html#guile-srfi-13
</advertise>

Regards,
  'martin



reply via email to

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