From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: ludo@gnu.org (Ludovic =?utf-8?Q?Court=C3=A8s?=) Newsgroups: gmane.lisp.guile.devel Subject: Re: wip-ports-refactor Date: Tue, 19 Apr 2016 16:15:41 +0200 Message-ID: <87zisp4rci.fsf@gnu.org> References: <87twjempnf.fsf@pobox.com> <87zisw9tju.fsf@gnu.org> <8760vgmxfy.fsf@pobox.com> <87a8ksecpg.fsf@gnu.org> <878u0ahvun.fsf@pobox.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1461075367 2539 80.91.229.3 (19 Apr 2016 14:16:07 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 19 Apr 2016 14:16:07 +0000 (UTC) Cc: guile-devel To: Andy Wingo Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Tue Apr 19 16:16:03 2016 Return-path: Envelope-to: guile-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1asWRb-0007Up-Rn for guile-devel@m.gmane.org; Tue, 19 Apr 2016 16:15:59 +0200 Original-Received: from localhost ([::1]:58881 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1asWRb-0001H2-67 for guile-devel@m.gmane.org; Tue, 19 Apr 2016 10:15:59 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:39712) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1asWRP-0001Dp-PU for guile-devel@gnu.org; Tue, 19 Apr 2016 10:15:48 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1asWRM-00040Q-E5 for guile-devel@gnu.org; Tue, 19 Apr 2016 10:15:47 -0400 Original-Received: from fencepost.gnu.org ([2001:4830:134:3::e]:47075) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1asWRM-00040K-1m; Tue, 19 Apr 2016 10:15:44 -0400 Original-Received: from reverse-83.fdn.fr ([80.67.176.83]:50082 helo=pluto) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_128_CBC_SHA1:128) (Exim 4.82) (envelope-from ) id 1asWRL-0001OS-EY; Tue, 19 Apr 2016 10:15:43 -0400 X-URL: http://www.fdn.fr/~lcourtes/ X-Revolutionary-Date: 1 =?utf-8?Q?Flor=C3=A9al?= an 224 de la =?utf-8?Q?R?= =?utf-8?Q?=C3=A9volution?= X-PGP-Key-ID: 0x3D9AEBB5 X-PGP-Key: http://www.fdn.fr/~lcourtes/ludovic.asc X-PGP-Fingerprint: 3CE4 6455 8A84 FDC6 9DB4 0CFB 090B 1199 3D9A EBB5 X-OS: x86_64-unknown-linux-gnu In-Reply-To: <878u0ahvun.fsf@pobox.com> (Andy Wingo's message of "Tue, 19 Apr 2016 10:00:00 +0200") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:4830:134:3::e 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:18292 Archived-At: Hello! Andy Wingo skribis: > On Sun 17 Apr 2016 12:44, ludo@gnu.org (Ludovic Court=C3=A8s) writes: > >> Andy Wingo skribis: >> >>> I want to test four things. >>> >>> ;; 1. How long a loop up to 10 million takes (baseline measurement). >>> (let ((port (open-input-string "s"))) (do-times #e1e7 1)) >>> >>> ;; 2. A call to a simple Scheme function. >>> (define (foo port) 42) >>> (let ((port (open-input-string "s"))) (do-times #e1e7 (foo port))) >>> >>> ;; 3. A call to a port subr. >>> (let ((port (open-input-string "s"))) (do-times #e1e7 (port-line po= rt))) >>> >>> ;; 4. A call to a port subr that touches the buffer. >>> (let ((port (open-input-string "s"))) (do-times #e1e7 (peek-char po= rt))) >>> >>> The results: >>> >>> | baseline | foo | port-line | peek-char >>> ------------------+----------+--------+-----------+---------- >>> guile 2.0 | 0.269s | 0.845s | 1.067s | 1.280s >>> guile master | 0.058s | 0.224s | 0.225s | 0.433s >>> wip-port-refactor | 0.058s | 0.220s | 0.226s | 0.375s >> >> Oh, nice! (By =E2=80=9Cprohibitively slow=E2=80=9D I was referring to 2= .0.) >> >> For =E2=80=98peek-char=E2=80=99, isn=E2=80=99t there also the fact that = string ports in 2.2 are >> UTF-8 by default, so we get the fast path, whereas in 2.0 there >> =E2=80=98%default-port-encoding=E2=80=99, which could be something else = leading to the >> slow path? > > I tried making sure the string port was a UTF-8 port but that made no > difference to the 2.0 peek-char times. I suspect this is because I ran > it at the REPL, which had done a setlocale() already. But perhaps > that's not the right explanation. It=E2=80=99s definitely the case if you use a UTF-8 locale. Thanks for checking! Ludo=E2=80=99.