On 2005-09-08 11:06:08, Ian Clelland wrote:
On 9/8/05, Stefan Scholl sscholl@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?
Yes, we can. :-)
Assuming, of course, that you don't have bigger and better plans for #'escape-for-html in the future.
Not at the moment. ESCAPE-FOR-HTML came first -- before CL-WHO.
I've just tested ESCAPE-FOR-HTML and ESCAPE-STRING on my slow (Dual Pentium III, 650 MHz, 512 MiB RAM) system:
WIKI> (let ((data (contents-of-file "Testpage"))) (time (test-escape-string data 10000)))
Warning: TIME form in a non-null environment, forced to interpret. Compiling entire form will produce more accurate times.
; Evaluation took: ; 106.06 seconds of real time ; 102.52042 seconds of user run time ; 3.545461 seconds of system run time ; 68,755,459,972 CPU cycles ; [Run times include 5.84 seconds GC run time] ; 0 page faults and ; 820,724,440 bytes consed. ; NIL WIKI> (let ((data (contents-of-file "Testpage"))) (time (test-escape-for-html data 10000)))
Warning: TIME form in a non-null environment, forced to interpret. Compiling entire form will produce more accurate times.
; Evaluation took: ; 106.14 seconds of real time ; 100.6897 seconds of user run time ; 5.441173 seconds of system run time ; 68,810,304,097 CPU cycles ; [Run times include 7.21 seconds GC run time] ; 0 page faults and ; 1,140,486,136 bytes consed. ; NIL
(Test loop is inside the _compiled_ test functions.)
"Testpage" has 32 KiB and 4 #& to escape. In lines 18, 42, 103, and 368 of 433 lines. CMUCL 18e, Linux 2.6.
ESCAPE-STRING seems to be better with this kind of texts. It's a bit early to optimize a program, but not too early to decide if a function is obsolete when there's an alternative.
Regards, Stefan
PS: Removed ESCAPE-FOR-HTML in development repository.