I forgot to mention that this is only for text static files like html.<br><br><div class="gmail_quote">On Fri, Jun 20, 2008 at 12:56 PM, Andrei Stebakov <<a href="mailto:lispercat@gmail.com">lispercat@gmail.com</a>> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">I had to come up with some way to cache dynamic files that I have to serve, so I ended up with a bunch of static files which I served by a simple function:<br>
(defun file-to-string (path)<br> "Reads a file into a string"<br>
(if (probe-file path)<br> (with-open-file (in path)<br> (let ((str (make-string (file-length in))))<br> (read-sequence str in)<br> str))))<br><br>The performance was very good, but then I thought that it's not the proper way to serve static files as there is a hunchentoot function handle-static-file.<br>
When I started using the hunchentoot's function the response time almost tripled and when I run "top" program to monitor CPU usage it jumps up to 60% (on my PIII 600 MHz) CPU, <br>whereas using file-to-string CPU usage stays with 2% (maybe because the serving time is much shorter top doesn't catch that CPU peak).<br>
My question is what could be the reason I see this behaviour? (I am using SBCL 1.0.15 with latest dependences of hunchentoot-0.15.7)<br><br>Thank you,<br>Andrew<br>
</blockquote></div><br>