[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Unbuffered socket I/O
From: |
Ludovic Courtès |
Subject: |
Re: Unbuffered socket I/O |
Date: |
Tue, 27 Feb 2007 10:11:20 +0100 |
User-agent: |
Gnus/5.110006 (No Gnus v0.6) Emacs/21.4 (gnu/linux) |
Hi,
Neil Jerram <address@hidden> writes:
> I have no technical objection to your patch, but I'm afraid you must
> be missing something, or else there is something special about the
> environment that you were measuring in. I have played with a few
> TCP-based Guile applications (including the Emacs debugging interface)
> and not noticed any obvious performance problem.
I tried the attached script, both with and without the patch. Here, it
says "time: 7" with the patch and "time: 2645" without.
Now, it seems that I was observing an even higher difference because the
Guile server script was running under `strace'... :-)
Thanks,
Ludovic.
(use-modules (srfi srfi-4))
(define %port 7778)
(define %size 5000000)
(define (time thunk)
(let ((start (get-internal-run-time)))
(thunk)
(let ((end (get-internal-run-time)))
(format #t "time: ~a~%" (- end start)))))
(if (= 0 (primitive-fork))
(let ((s (socket PF_INET SOCK_STREAM 0)))
(bind s AF_INET INADDR_LOOPBACK %port)
(listen s 1024)
(format #t "accepting connections...~%")
(let* ((accepted (accept s))
(port (car accepted))
(vec (make-u8vector %size)))
(time
(lambda ()
(uniform-vector-read! vec port)))
(close-port port)))
(let ((s (socket PF_INET SOCK_STREAM 0))
(vec (make-u8vector %size)))
(format #t "client~%")
(sleep 1)
(connect s AF_INET INADDR_LOOPBACK %port)
(format #t "writing...~%")
(uniform-vector-write vec s)
(format #t "done.~%")
(close-port s)))
- Unbuffered socket I/O, Ludovic Courtès, 2007/02/23
- Re: Unbuffered socket I/O, Neil Jerram, 2007/02/23
- Re: Unbuffered socket I/O, Kevin Ryde, 2007/02/25
- Re: Unbuffered socket I/O, Kevin Ryde, 2007/02/26
- Re: Unbuffered socket I/O, Ludovic Courtès, 2007/02/28
- Re: Unbuffered socket I/O, Kevin Ryde, 2007/02/28