On Thu, 22 Mar 2007 12:39:40 +0000, "Robert Synnott" rsynnott@gmail.com wrote:
I was really just using the big static file to demonstrate the problem; it's visible when sending dynamically generated pages as well, but just not by so huge a margin (because the pages aren't as big, I think; the bigger the page, the more the speed difference between tbnl and hunchentoot seems to be).
I've just uploaded a new release of FLEXI-STREAMS (0.11.1) which incorporates the patches I was talking about. This should make Hunchentoot output significantly faster /if/ you're using an 8-bit encoding without line encoding conversions (like the default format), but it'll still be an order of magnitude slower than writing binary data directly to the stream.
Let us know if this helps.
I'm happy to accept reasonable patches to make FLEXI-STREAMS faster, but obviously there's a certain price you have to pay for flexibility and portability.
Note that you can of course bypass FLEXI-STREAMS if you absolutely need the speed. Something like this (untested):
(defun my-handler () ;; no need to generate the content before calling SEND-HEADERS, ;; but that way your errors will be handled by Hunchentoot (let ((content (generate-content)) (stream (flexi-stream-stream (send-headers)))) (write-sequence (maybe-convert content) stream)))
Try it...
STREAM will either be the raw socket stream or a chunked stream from Chunga depending on how you've started your server. (You can put Hunchentoot behind mod_lisp and use :INPUT-CHUNKING-P NIL and :MOD-LISP-P T to bypass Chunga as well.)