guile-user
[Top][All Lists]
Advanced

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

Re: string vs list processing


From: Michael Livshin
Subject: Re: string vs list processing
Date: 16 Apr 2001 16:45:28 +0300
User-agent: Gnus/5.0807 (Gnus v5.8.7) XEmacs/21.1 (Crater Lake)

address@hidden (Bill Gribble) writes:

> 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.

yup.  even better (well, conceptually at least), keep your HTML
document as a tree of elements.  and print it out by walking the tree.
looks nicely structured when pretty-printed, too.

[ note: all this is not to say that Guile's string operations are
  extremely efficient.  but IME most problems that call for fast
  string operations turn out to be better much solved by different
  means. ]

-- 
Hit the philistines three times over the head with the Elisp reference manual.
                -- Michael A. Petonic




reply via email to

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