[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: RPC performance
From: |
Andy Wingo |
Subject: |
Re: RPC performance |
Date: |
Thu, 22 Jun 2017 16:03:57 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/25.1 (gnu/linux) |
On Mon 19 Jun 2017 10:15, address@hidden (Ludovic Courtès) writes:
> +(define (buffering-output-port port buffer)
> + ;; Note: In Guile 2.2.2, custom binary output ports already have their own
> + ;; 4K internal buffer.
> + (define size
> + (bytevector-length buffer))
> +
> + (define total 0)
> +
> + (define (flush)
> + (put-bytevector port buffer 0 total)
> + (set! total 0))
> +
> + (define (write bv offset count)
> + (if (zero? count) ;end of file
> + (flush)
> + (let loop ((offset offset)
> + (count count)
> + (written 0))
> + (cond ((= total size)
> + (flush)
> + (loop offset count written))
> + ((zero? count)
> + written)
> + (else
> + (let ((to-copy (min count (- size total))))
> + (bytevector-copy! bv offset buffer total to-copy)
> + (set! total (+ total to-copy))
> + (loop (+ offset to-copy) (- count to-copy)
> + (+ written to-copy))))))))
> +
> + (let ((port (make-custom-binary-output-port "buffering-output-port"
> + write #f #f flush)))
> + (setvbuf port _IONBF)
> + port))
> +
Why not just set to _IOFBF and let Guile 2.2's buffering handle it?
Andy
- Re: Performance on NFS, (continued)
- Re: Performance on NFS, Roel Janssen, 2017/06/12
- Re: Performance on NFS, Ludovic Courtès, 2017/06/12
- Performance on NFS, Ludovic Courtès, 2017/06/16
- Re: Performance on NFS, Roel Janssen, 2017/06/17
- Re: Performance on NFS, Ludovic Courtès, 2017/06/17
- Re: Performance on NFS, Roel Janssen, 2017/06/17
- Re: Performance on NFS, Ricardo Wurmus, 2017/06/18
- RPC performance, Ludovic Courtès, 2017/06/19
- Re: RPC performance, Ludovic Courtès, 2017/06/19
- Re: RPC performance, Ricardo Wurmus, 2017/06/19
- Re: RPC performance,
Andy Wingo <=
- Re: RPC performance, Ludovic Courtès, 2017/06/22
- Re: RPC performance, Andy Wingo, 2017/06/23
- Re: RPC performance, Ludovic Courtès, 2017/06/23
- Re: RPC performance, Andy Wingo, 2017/06/23
- Re: RPC performance, Ludovic Courtès, 2017/06/26
- Re: RPC performance, Andy Wingo, 2017/06/26
- Re: RPC performance, Ludovic Courtès, 2017/06/19
- Re: RPC performance, Ricardo Wurmus, 2017/06/22
- Re: Combining Guix, direnv and Emacs for environment customisation, Ricardo Wurmus, 2017/06/07
- Performance on NFS, Ludovic Courtès, 2017/06/07