From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Rob Browning Newsgroups: gmane.lisp.guile.devel Subject: Re: Unexpectedly low read/write performance of open-pipe Date: Tue, 09 Apr 2019 01:56:37 -0500 Message-ID: <87k1g3ll96.fsf@trouble.defaultvalue.org> References: <87d0lxmzyv.fsf@trouble.defaultvalue.org> <878swlmz6q.fsf@trouble.defaultvalue.org> <874l79mwbw.fsf@trouble.defaultvalue.org> <87zhp1ld31.fsf@trouble.defaultvalue.org> <87sgus6a65.fsf@netris.org> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="103290"; mail-complaints-to="usenet@blaine.gmane.org" Cc: guile-devel@gnu.org To: Mark H Weaver Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Tue Apr 09 08:56:57 2019 Return-path: Envelope-to: guile-devel@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hDkgi-000Qjg-UF for guile-devel@m.gmane.org; Tue, 09 Apr 2019 08:56:57 +0200 Original-Received: from localhost ([127.0.0.1]:36477 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hDkgh-0002qs-Vr for guile-devel@m.gmane.org; Tue, 09 Apr 2019 02:56:56 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:52016) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hDkgU-0002qa-1R for guile-devel@gnu.org; Tue, 09 Apr 2019 02:56:42 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hDkgS-0007ZX-OT for guile-devel@gnu.org; Tue, 09 Apr 2019 02:56:41 -0400 Original-Received: from defaultvalue.org ([45.33.119.55]:35562) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hDkgS-0007XW-H2 for guile-devel@gnu.org; Tue, 09 Apr 2019 02:56:40 -0400 Original-Received: from trouble.defaultvalue.org (localhost [127.0.0.1]) (Authenticated sender: rlb@defaultvalue.org) by defaultvalue.org (Postfix) with ESMTPSA id 7614D2022B; Tue, 9 Apr 2019 01:56:38 -0500 (CDT) Original-Received: by trouble.defaultvalue.org (Postfix, from userid 1000) id E710214E05C; Tue, 9 Apr 2019 01:56:37 -0500 (CDT) In-Reply-To: <87sgus6a65.fsf@netris.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 45.33.119.55 X-BeenThere: guile-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Developers list for Guile, the GNU extensibility library" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Original-Sender: "guile-devel" Xref: news.gmane.org gmane.lisp.guile.devel:19880 Archived-At: Mark H Weaver writes: > See below for a draft reimplementation of the OPEN_BOTH mode of > open-pipe* based on R6RS custom binary input/output. On my machine it > increases the speed of your test by a factor of ~1k. Hah, I was about to report that I'd tested something along similar lines (though much more a quick hack to just replace make-rw-port and see what happened), and that I had seen substantial improvements: (define (make-rw-bin-port read-port write-port) (define (read! dest offset count) (let ((result (get-bytevector-n! read-port dest offset count))) (if (eof-object? result) 0 result))) (define (write! src offset count) (put-bytevector write-port src offset count) count) (define (close x) (close-port read-port) (close-port write-port)) (make-custom-binary-input/output-port "open-bin-pipe-port" read! write! #f #f close)) > Let me know how it works for you. For a first quick test of your patch using the original program I was working on, I see about ~1.4MiB/s without the patch, and about 150MiB/s with it, measured by pv. (If the patch holds up, it'd be nice to have in 2.2, but I suppose that might not be appropriate.) Thanks -- Rob Browning rlb @defaultvalue.org and @debian.org GPG as of 2011-07-10 E6A9 DA3C C9FD 1FF8 C676 D2C4 C0F0 39E9 ED1B 597A GPG as of 2002-11-03 14DD 432F AE39 534D B592 F9A0 25C8 D377 8C7E 73A4