From: <don...@is...> - 2003-10-09 15:49:43
|
> (transmission speed approx. 300 bytes / sec!!!). This is much slower than I normally see. > the problem seems to be the read-byte/char and write-byte/char loops, like > in server.lisp: > > (loop for i from start below end > for char-number below *cycle-io-limit* > while (output-possible stream) do > (write-char (char output i) stream) > finally > (force-output stream) > (setf (third out) i) > (if (>= i end) (pop (output connection)) > (return-from process-output nil))) You are correct that this is the bottleneck. At the end of server.lisp are some timings. On a 200MHz machine the cost is something like 25usec/character, half for the output-possible and half for the output. That comes out to about 40K chars/sec. On a modern machine you ought to get about 400K. I don't think this is the reason for 300B/s unless you have a REALLY slow machine. Or maybe you're running the code interpreted? [Sam writes] > use > write-char-sequence (http://clisp.cons.org/impnotes.html#wr-ch-seq) > write-byte-sequence (http://clisp.cons.org/impnotes.html#wr-by-seq) > read-char-sequence (http://clisp.cons.org/impnotes.html#rd-ch-seq) > read-byte-sequence (http://clisp.cons.org/impnotes.html#rd-by-seq) > instead of write-char, write-byte, read-char, read-byte. > > or create buffered socket streams > (http://clisp.cons.org/impnotes.html#buffered) > > note the new :NO-HANG arguments to read-byte-sequence (2.31) and > write-byte-sequence (CVS head). The no hang argument for write-byte-sequence was added specifically for this reason. I have a new version of server.lisp that uses it and, as expected, it's MUCH faster. I've not put the new version on clocc yet because it doesn't work with the latest release. I suppose I should make a version that works the new way if you have the new clisp and the old way if you don't. Of course, this won't do you any good unless you do a cvs build. |