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.user Subject: Re: How to read integers from file faster? Date: Sun, 01 Sep 2013 15:33:54 +0200 Message-ID: <87zjrwpsxp.fsf@gnu.org> References: <87ppsu8bex.fsf@pobox.com> <87wqn2upr6.fsf@gnu.org> <8738pp0w33.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 1378042753 24615 80.91.229.3 (1 Sep 2013 13:39:13 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 1 Sep 2013 13:39:13 +0000 (UTC) Cc: guile-user@gnu.org To: Andy Wingo Original-X-From: guile-user-bounces+guile-user=m.gmane.org@gnu.org Sun Sep 01 15:39:15 2013 Return-path: Envelope-to: guile-user@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 1VG7s2-0001I5-JK for guile-user@m.gmane.org; Sun, 01 Sep 2013 15:39:14 +0200 Original-Received: from localhost ([::1]:34059 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VG7s2-0007T3-81 for guile-user@m.gmane.org; Sun, 01 Sep 2013 09:39:14 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:41184) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VG7rp-0007Sy-Gc for guile-user@gnu.org; Sun, 01 Sep 2013 09:39:06 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VG7rk-0002ov-Dq for guile-user@gnu.org; Sun, 01 Sep 2013 09:39:01 -0400 Original-Received: from hera.aquilenet.fr ([141.255.128.1]:58760) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VG7rk-0002oc-7p for guile-user@gnu.org; Sun, 01 Sep 2013 09:38:56 -0400 Original-Received: from localhost (localhost [127.0.0.1]) by hera.aquilenet.fr (Postfix) with ESMTP id 41EE5118E; Sun, 1 Sep 2013 15:33:55 +0200 (CEST) Original-Received: from hera.aquilenet.fr ([127.0.0.1]) by localhost (hera.aquilenet.fr [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id ZMugsBfg0INN; Sun, 1 Sep 2013 15:33:55 +0200 (CEST) Original-Received: from pluto (reverse-83.fdn.fr [80.67.176.83]) by hera.aquilenet.fr (Postfix) with ESMTPSA id E1281E81; Sun, 1 Sep 2013 15:33:54 +0200 (CEST) X-URL: http://www.fdn.fr/~lcourtes/ X-Revolutionary-Date: 15 Fructidor an 221 de la =?utf-8?Q?R=C3=A9volution?= X-PGP-Key-ID: 0xEA52ECF4 X-PGP-Key: http://www.fdn.fr/~lcourtes/ludovic.asc X-PGP-Fingerprint: 83C4 F8E5 10A3 3B4C 5BEA D15D 77DD 95E2 EA52 ECF4 X-OS: x86_64-unknown-linux-gnu In-Reply-To: <8738pp0w33.fsf@pobox.com> (Andy Wingo's message of "Sun, 01 Sep 2013 10:45:04 +0200") User-Agent: Gnus/5.130007 (Ma Gnus v0.7) Emacs/24.3 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x [fuzzy] X-Received-From: 141.255.128.1 X-BeenThere: guile-user@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: General Guile related discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-user-bounces+guile-user=m.gmane.org@gnu.org Original-Sender: guile-user-bounces+guile-user=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.user:10740 Archived-At: Andy Wingo skribis: > On Sat 31 Aug 2013 12:19, ludo@gnu.org (Ludovic Court=C3=A8s) writes: > >> Andy Wingo skribis: >> >>> I just took a look at your program, which ran in 40s on my machine. >>> Under callgrind it turned out that we were doing a lot of iconv stuff >>> that we didn't need to do. >> >> It=E2=80=99s often the case that I/O is faster if you explicitly say tha= t the >> port is UTF-8-encoded, because there=E2=80=99s a fast path for that (not= using >> iconv) in 2.0: >> >> (with-fluids ((%default-port-encoding "UTF-8")) >> (call-with-input-file file >> ...)) > > Yep. In this particular case, it turned out that even in UTF-8 locales, > scm_ungetc_unlocked and scm_from_port_string were going through iconv. Aah, ungetc, OK. Ludo=E2=80=99.