[cl-wiki-devel] Encoding question and a patch

Ian Clelland clelland at gmail.com
Thu Sep 8 18:06:08 UTC 2005


On 9/8/05, Stefan Scholl <sscholl at common-lisp.net> wrote:
> 
> ESCAPE-STRING gets called when the symbol ESC is found inside
> CL-WHO's WITH-HTML-OUTPUT-TO-STRING

That's what I discovered while looking at the Unicode issue a couple
of days ago. Does this mean that we don't need #'escape-for-html at
all, and can just call #'escape-string in its place?

Assuming, of course, that you don't have bigger and better plans for
#'escape-for-html in the future.

> Have you tested both functions with a larger string? About 20 KiB
> or something? From the code I've seen ESCAPE-STRING seems to be
> optimized that way that it outputs larger chunks of code between
> the characters that needed escaping.

The code looks like it's optimised for large blocks of characters
which don't need to be escaped, with just a few escaped characters
here and there. Of course, since we're not using it to escape all
chars > 127, that should describe most text that it gets called on.

I only tested it on a small string, ~100B. 1.5e6 iterations of
#'escape-for-html ran in 282s, averaged over several runs, while
#'esacape-string took 412s. Not the most scientific test, I'm sure,
but I was just looking for big, order-of-magnitude differences.

-- 
Regards,
Ian Clelland
<clelland at gmail.com>



More information about the Cl-wiki-devel mailing list