[Openmcl-devel] Transfer the contents of a file to a tcp stream
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!
On May 3, 2005, at 20:18, Christian Nybø wrote:
> 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 out 'ccl::ioblock)
> (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
> is buffer 0
> (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
> 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]
> Openmcl-devel mailing list
> Openmcl-devel at clozure.com
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 2367 bytes
Desc: not available
More information about the Openmcl-devel