From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Andy Wingo Newsgroups: gmane.lisp.guile.devel Subject: Re: wip-ports-refactor Date: Tue, 10 May 2016 18:53:47 +0200 Message-ID: <87wpn1q2g4.fsf@pobox.com> References: <87twjempnf.fsf@pobox.com> <87zisw9tju.fsf@gnu.org> <8760vgmxfy.fsf@pobox.com> <871t5aq7la.fsf@pobox.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1462899255 3696 80.91.229.3 (10 May 2016 16:54:15 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 10 May 2016 16:54:15 +0000 (UTC) Cc: guile-devel To: ludo@gnu.org (Ludovic =?utf-8?Q?Court=C3=A8s?=) Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Tue May 10 18:54:07 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 1b0Av8-0003TL-LC for guile-devel@m.gmane.org; Tue, 10 May 2016 18:54:06 +0200 Original-Received: from localhost ([::1]:47605 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b0Av7-0000k7-IA for guile-devel@m.gmane.org; Tue, 10 May 2016 12:54:05 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:45222) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b0Av4-0000ee-3D for guile-devel@gnu.org; Tue, 10 May 2016 12:54:03 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1b0Auz-0003hf-NS for guile-devel@gnu.org; Tue, 10 May 2016 12:54:00 -0400 Original-Received: from pb-sasl2.pobox.com ([64.147.108.67]:51789 helo=sasl.smtp.pobox.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b0Auz-0003hR-GT; Tue, 10 May 2016 12:53:57 -0400 Original-Received: from sasl.smtp.pobox.com (unknown [127.0.0.1]) by pb-sasl2.pobox.com (Postfix) with ESMTP id C4E6A1978A; Tue, 10 May 2016 12:53:55 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=pobox.com; h=from:to:cc :subject:references:date:in-reply-to:message-id:mime-version :content-type; s=sasl; bh=Cb+z5U/aYtB7L1LMbYydS2eAqW8=; b=c5M1WQ A/95Y4jSbThph1eZ4j2vuUrqUtPCyGF27+EEZ0/8JvzmT2SDo3JzqBM0TW2LA/mg Le+QBcNJOrFQny+lSqhoBa297fgmJIO0nMe/Nd2upgs6mueyWT0TCWe69+50Mpxf 1HJKD0KcyNkwuhVUIEjiFh0hj8/8wlOvLl+0c= DomainKey-Signature: a=rsa-sha1; c=nofws; d=pobox.com; h=from:to:cc :subject:references:date:in-reply-to:message-id:mime-version :content-type; q=dns; s=sasl; b=CP26kIKV6Vb50hvb6I1k4FQqOAhLCj3N PHtud9bKYDbuY+OWo4KrOrqCbPR2wi8nP578IP0xdzazHLbU5sKuF+qurJRt1Ssk LuGzIkw01t4B/61Tlg/w2FMSzwC1TnrIauta/X4jkaOGIEOlmzViCvpNMQ5Z0oxT eIq/up6jMsA= Original-Received: from pb-sasl2. (unknown [127.0.0.1]) by pb-sasl2.pobox.com (Postfix) with ESMTP id BD13C19789; Tue, 10 May 2016 12:53:55 -0400 (EDT) Original-Received: from clucks (unknown [88.160.190.192]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by pb-sasl2.pobox.com (Postfix) with ESMTPSA id 134A819787; Tue, 10 May 2016 12:53:54 -0400 (EDT) In-Reply-To: <871t5aq7la.fsf@pobox.com> (Andy Wingo's message of "Tue, 10 May 2016 17:02:41 +0200") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux) X-Pobox-Relay-ID: C818D60C-16CF-11E6-B348-D472793246D6-02397024!pb-sasl2.pobox.com X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 64.147.108.67 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:18301 Archived-At: On Tue 10 May 2016 17:02, Andy Wingo writes: > (with-output-to-file "/tmp/testies.txt" (lambda () (do-times #e1e6 (write-char #\a)))) Sorry, I meant #e1e7. The file really does have 10M characters. Actually 10M+1 because of a do-times bug :P > > This is in a UTF-8 locale. OK. So we have 10M "a" characters. I now > want to test these things: > > 1. peek-char, 1e7 times. > 2. read-char, 1e7 times. > 3. lookahead-u8, 1e7 times. (Call it peek-byte.) > 4. get-u8, 1e7 times. (Call it read-byte.) > > | peek-char | read-char | peek-byte | read-byte > ---------------------+-----------+-----------+-----------+---------- > 2.0 | 0.811s | 0.711s | 0.619s | 0.623s > master | 0.410s | 0.331s | 0.428s | 0.411s > port-refactor C | 0.333s | 0.358s | 0.265s | 0.245s > port-refactor Scheme | 1.041s | 1.820s | 0.682s | 0.727s > > Again, measurements on my i7-5600U, best of three, --no-debug. > > Conclusions: > > 1. In Guile master and 2.0, reading is faster than peeking, because it > does a read then a putback. In wip-port-refactor, the reverse is > true: peeking fills the buffer, and reading advances the buffer > pointers. > > 2. Scheme appears to be about 3-4 times slower than C in > port-refactor. It's slower than 2.0, unfortunately. I am certain > that we will get the difference back when we get native compilation > but I don't know when that would be. > > 3. There are some compiler improvements that could help Scheme > performance too. For example the bit that updates the port > positions is not optimal. We could expose it from C of course. > > Note that this Scheme implementation passes ports.test, so there > shouldn't be any hidden surprises. > > I am not sure what to do, to be honest. I think I would switch to > Scheme if it let me throw away the C code, but I don't see the path > forward on that right now due to bootstrap reasons. I think if I could > golf `read-char' down to 1.100s or so it would become more palatable. > > Andy