From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andy Wingo Subject: Re: RPC performance Date: Thu, 22 Jun 2017 16:03:57 +0200 Message-ID: <87o9tg5dbm.fsf@igalia.com> References: <20170527105641.9426-1-mail@cbaines.net> <20170527123113.1ca668e7@cbaines.net> <87tw424cap.fsf@gnu.org> <87fufhkw85.fsf@gnu.org> <871sr0ok2h.fsf@gnu.org> <8760gbh2th.fsf@gnu.org> <87efuym57c.fsf@gnu.org> <87a85kt7ad.fsf_-_@gnu.org> <87a85hnvqm.fsf@gnu.org> <87tw3lyz7t.fsf@inria.fr> <87poe4c5y9.fsf_-_@gnu.org> <87fuezkquf.fsf@gnu.org> <87lgoq8ch8.fsf@gnu.org> <87k2497kk7.fsf@elephly.net> <87vans1k5e.fsf_-_@inria.fr> <87poe01jgo.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:40184) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dO2iQ-0008WG-JP for guix-devel@gnu.org; Thu, 22 Jun 2017 10:04:16 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dO2iM-0007xg-LT for guix-devel@gnu.org; Thu, 22 Jun 2017 10:04:10 -0400 Received: from pb-sasl2.pobox.com ([64.147.108.67]:64776 helo=sasl.smtp.pobox.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dO2iM-0007xX-IC for guix-devel@gnu.org; Thu, 22 Jun 2017 10:04:06 -0400 In-Reply-To: <87poe01jgo.fsf@gnu.org> ("Ludovic =?utf-8?Q?Court=C3=A8s=22'?= =?utf-8?Q?s?= message of "Mon, 19 Jun 2017 10:15:51 +0200") List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org Sender: "Guix-devel" To: Ludovic =?utf-8?Q?Court=C3=A8s?= Cc: guix-devel@gnu.org On Mon 19 Jun 2017 10:15, ludovic.courtes@inria.fr (Ludovic Court=C3=A8s) w= rites: > +(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 ((=3D 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