[Openmcl-devel] Transfer the contents of a file to a tcp stream
Richard Newman
rich at holygoat.co.uk
Tue May 3 13:07:26 PDT 2005
Just a thought -- the calculated speed of a transfer includes the setup
and tear-down times for the connection, as far as I can see.
I don't know how big that file is, but try it with one that's 50MB or
more, so that the transfer time becomes more significant. It might be
that you're optimising the wrong part of your program.
Failing that... profile!
-R
On May 3, 2005, at 20:18, Christian Nybø wrote:
> Hello,
>
> If there is a better place for user-level questions on openmcl, please
> let me know.
>
> Could you suggest how to speed up a transfer of the contents of a file
> to a tcp stream? My code looks like this:
>
> (defun print-file-to-output-stream (in out)
> "Read from in and write to out."
> (with-open-file (is in :element-type 'unsigned-byte)
> (let* ((buffer-size
> (slot-value
> (slot-value
> (slot-value out 'ccl::ioblock)
> 'ccl::outbuf)
> 'ccl::size))
> (buffer (make-array buffer-size
> :element-type 'unsigned-byte)))
> (declare (type fixnum buffer-size)
> (optimize (speed 3) (safety 0)))
> (tagbody read-seq
> (if (= (ccl::stream-write-ivector
> out buffer 0
> (ccl::stream-read-ivector
> is buffer 0
> buffer-size))
> buffer-size)
> (go read-seq)
> (force-output out))))))
>
> It seems that apache in comparison serves a file at about twice the
> speed as my own server. Any ideas on how to speed it up?
>
> Asking apache for the file:
> chr at macchr/~/downloads/ccl$ wget
> http://localhost/%7Echr/nasa-zambia.jpeg
> 21:15:27 (6.35 MB/s) - `nasa-zambia.jpeg.79' saved [2538796/2538796]
>
> Asking my own cl server for the file:
> chr at macchr/~/downloads/ccl$ wget http://localhost:8000/nasa-zambia.jpeg
> 21:15:41 (3.91 MB/s) - `nasa-zambia.jpeg.80' saved [2538796/2538796]
>
> --
> chr
>
> _______________________________________________
> Openmcl-devel mailing list
> Openmcl-devel at clozure.com
> http://clozure.com/mailman/listinfo/openmcl-devel
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 2367 bytes
Desc: not available
URL: <https://lists.clozure.com/pipermail/openmcl-devel/attachments/20050503/96aa620d/attachment.bin>
More information about the Openmcl-devel
mailing list