From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: hylophile@posteo.de Newsgroups: gmane.lisp.guile.bugs Subject: bug#59321: ice-9's open-input-pipe is unexpectedly slow on some systems Date: Wed, 16 Nov 2022 18:06:06 +0000 Message-ID: <8d55cf7d1e5382c874cfcaee1f4cddd3@posteo.de> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="13847"; mail-complaints-to="usenet@ciao.gmane.io" To: 59321@debbugs.gnu.org Original-X-From: bug-guile-bounces+guile-bugs=m.gmane-mx.org@gnu.org Wed Nov 16 21:57:40 2022 Return-path: Envelope-to: guile-bugs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1ovPTY-0003Ri-4g for guile-bugs@m.gmane-mx.org; Wed, 16 Nov 2022 21:57:40 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ovPSz-0008Kz-UO; Wed, 16 Nov 2022 15:57:05 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ovPSx-0008KC-0n for bug-guile@gnu.org; Wed, 16 Nov 2022 15:57:03 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ovPSw-00087G-OD for bug-guile@gnu.org; Wed, 16 Nov 2022 15:57:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1ovPSw-0001gi-L9 for bug-guile@gnu.org; Wed, 16 Nov 2022 15:57:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: hylophile@posteo.de Original-Sender: "Debbugs-submit" Resent-CC: bug-guile@gnu.org Resent-Date: Wed, 16 Nov 2022 20:57:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 59321 X-GNU-PR-Package: guile X-Debbugs-Original-To: bug-guile@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.16686321876431 (code B ref -1); Wed, 16 Nov 2022 20:57:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 16 Nov 2022 20:56:27 +0000 Original-Received: from localhost ([127.0.0.1]:58296 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ovPSM-0001fc-1h for submit@debbugs.gnu.org; Wed, 16 Nov 2022 15:56:27 -0500 Original-Received: from lists.gnu.org ([209.51.188.17]:46690) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ovMnf-0001KU-3e for submit@debbugs.gnu.org; Wed, 16 Nov 2022 13:06:16 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ovMne-000064-VM for bug-guile@gnu.org; Wed, 16 Nov 2022 13:06:14 -0500 Original-Received: from mout02.posteo.de ([185.67.36.66]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ovMnb-0006OC-NI for bug-guile@gnu.org; Wed, 16 Nov 2022 13:06:14 -0500 Original-Received: from submission (posteo.de [185.67.36.169]) by mout02.posteo.de (Postfix) with ESMTPS id 72DB4240106 for ; Wed, 16 Nov 2022 19:06:08 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.de; s=2017; t=1668621968; bh=IIoD+jhfwHM6ZuuCarXFMvsSagbavs9K9tTw5EPtQL8=; h=Date:From:To:Subject:From; b=L4aEJ4Y9WclUgj2Jdf5bJHBj7xLn/DbGpnq9MFWGTL1r47gqMSkAscmNyTRxTNny5 liNm/sjOnTd1ti1URzsW/EeVZAosMwjwemxyUDbL/WrjlnFyzKA2mw/cY5N45nkCNy Ez2opvoKjCzFUQtmslmIoxQMbMsBy4XnYjHE9LmK7ce7ENKn2KmbgAkkXRCveJEj+0 mCtU5tnenFzwnPJhYYmzJQiYTwPncCG0ZzoLiClyrpaVJT2XD0tOTF+TWpQvCbRnt3 oJyOVeQzQwi0x9HgWdbm7sM25VBJ2fdZwCBKxRV+j2DvQDmsQxq+2wYrjo7UOnLDtM WzD5Lk+czlWeQ== Original-Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4NC9vz1S70z6tpm for ; Wed, 16 Nov 2022 19:06:07 +0100 (CET) Received-SPF: pass client-ip=185.67.36.66; envelope-from=hylophile@posteo.de; helo=mout02.posteo.de X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Mailman-Approved-At: Wed, 16 Nov 2022 15:56:23 -0500 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-guile@gnu.org List-Id: "Bug reports for GUILE, GNU's Ubiquitous Extension Language" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-guile-bounces+guile-bugs=m.gmane-mx.org@gnu.org Original-Sender: bug-guile-bounces+guile-bugs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.lisp.guile.bugs:10433 Archived-At: Hi, while doing my first steps in Guile and porting a small shell script, I noticed that capturing stdout from a subshell is very slow: $ time guile -c '(begin (use-modules (ice-9 popen) (ice-9 rdelim)) (display (read-delimited "" (open-input-pipe "ls"))))' # real 0m0,313s user 0m0,008s sys 0m0,007s It takes around 300ms where I would expect around 40ms. The slowness happens on one of my machines, but not the other (at least not noticeably). However, I am fairly sure that my machine is not at fault, because this doesn't happen with other languages. Additionally, another Guile user tried this on their machines and also noticed slowness (around 200ms) on one of their machines. We did notice that the machines where the operation runs fast also run on better hardware, but the stark difference is still unexpected. Unfortunately I am not sure what exactly causes the issue, but I am happy to provide any further information needed. The mentioned Guile user was able to pinpoint the delay to be between two read system calls by going through an strace. To reproduce: 1. Create an empty folder with one file named "testfile" in it 2. Run: $ strace -o ice-9.trace -s 256 --timestamps=format:time,precision:ms guile -c '(begin (use-modules (ice-9 popen) (ice-9 rdelim)) (display (read-delimited "" (open-input-pipe "ls"))))' 3. In the resulting ice-9.trace, search for "testfile" and go up to the first read call which reads the output of ls. Between the first and the second read call, there is a noticeable delay. For one of my systems it's around 300ms, for the other it's around 90ms: 18:37:08.880 close(6) = 0 18:37:08.880 read(5, "i", 1) = 1 18:37:09.189 --- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=188843, si_uid=1000, si_status=0, si_utime=15 /* 0.15 s */, si_stime=14 /* 0.14 s */} --- 18:37:09.189 read(5, "c", 1) = 1 18:37:09.189 read(5, "e", 1) = 1 Regards, Nate System information: guile (GNU Guile) 3.0.8 I am using the Arch Linux guile package, I believe the build configuration can be found here: https://github.com/archlinux/svntogit-packages/blob/packages/guile/trunk/PKGBUILD#L23 Output of config.guess: x86_64-pc-linux-gnu