From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: =?utf-8?Q?G=C3=B6ran?= Weinholt Newsgroups: gmane.lisp.guile.devel Subject: Re: SHA256 performance with Guile 2.2 vs. Guile 3.0 Date: Sat, 04 Jan 2020 11:28:01 +0100 Message-ID: <87h81b7bym.fsf@teapot.weinholt.se> References: <874kxcnlh8.fsf@inria.fr> <87sgkwm4uv.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="137574"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) Cc: Andy Wingo , Guile Devel To: Ludovic =?utf-8?Q?Court=C3=A8s?= Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Sat Jan 04 11:35:47 2020 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.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1ingmX-000ZZR-7i for guile-devel@m.gmane.org; Sat, 04 Jan 2020 11:35:45 +0100 Original-Received: from localhost ([::1]:33036 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ingmV-0001jX-Tp for guile-devel@m.gmane.org; Sat, 04 Jan 2020 05:35:44 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:40199) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ingmJ-0001jO-Q1 for guile-devel@gnu.org; Sat, 04 Jan 2020 05:35:32 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ingmI-0002xu-G5 for guile-devel@gnu.org; Sat, 04 Jan 2020 05:35:31 -0500 Original-Received: from iustitia.weinholt.se ([2a02:28f0:0:a::7dce:e5a8]:41830) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1ingmC-0001dM-8U; Sat, 04 Jan 2020 05:35:24 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=weinholt.se ; s=iustitia2012; h=Content-Transfer-Encoding:Content-Type:MIME-Version: Message-ID:In-Reply-To:Date:References:Subject:Cc:To:From:Sender:Reply-To: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=oZx/VmN90Shf7iS8mOMqKb5Y+ye00MzBDRtpr4ZiRiQ=; b=tTNjq1C6SnY5d5NIjCh9UTi3Cd 9CycL6tLa/CjJoVmg6oMDiNJrEjAxs5H6LecDEpuNvY0LfFsCa3BM7o9GGXrWZsMu73xvXBHntRLq Hh9VlLgFchQjCsFomSmeqV768NRRGIGzrhXqkrXE81hdoWlieh6C6voM3w3BTOMT2frVOapyXy28p rSysYiWRSn8l/eaYHZXGFbRrcTQ6HGctBeGX0sYGwQCvBno6CcpKTaAjrNyDncVGA7SfzIewlXpzI 2mI7KfGkosYHLqA48mx/6mlHpBMBHNJCJ3OJGoKMUVltuIL+0+GNuF93NOqW0OSy2Fm99KCAFX12l 2tU3hxlQ==; Original-Received: from uucp by iustitia.weinholt.se with local-bsmtp (Exim 4.89) (envelope-from ) id 1inglu-0006qf-C7; Sat, 04 Jan 2020 11:35:06 +0100 Original-Received: from weinholt by teapot with local (Exim 4.93-RC5) (envelope-from ) id 1ingf3-000FiW-UZ; Sat, 04 Jan 2020 11:28:01 +0100 X-Hashcash: 1:20:200104:guile-devel@gnu.org::uUHZGTPoo2geLmBk:00000000000000000000000000000000000000000026Kn X-Hashcash: 1:20:200104:ludo@gnu.org::ysY6mtDRe6U3NMWk:000002Psz X-Hashcash: 1:20:200104:wingo@igalia.com::P8L93MQAN0M1NhWA:07H1k In-Reply-To: <87sgkwm4uv.fsf@gnu.org> ("Ludovic =?utf-8?Q?Court=C3=A8s=22'?= =?utf-8?Q?s?= message of "Sat, 04 Jan 2020 01:40:08 +0100") X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a02:28f0:0:a::7dce:e5a8 X-BeenThere: guile-devel@gnu.org X-Mailman-Version: 2.1.23 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:20211 Archived-At: Ludovic Court=C3=A8s writes: > Ludovic Court=C3=A8s skribis: > >> ludo@ribbon ~/src/guix$ ./pre-inst-env guix environment --pure --ad-hoc = guile-next guile3.0-hashing -- guile ~/tmp/sha256.scm >> >> ;;; (hash "b33576331465a60b003573541bf3b1c205936a16c407bc69f8419a527bf5c= 988") >> clock utime stime cutime cstime gctime >> 65.17 89.75 0.45 0.00 0.00 35.63 > > The patch below gives us: > > ludo@ribbon /tmp/hashing$ guile --r6rs -L .. ~/tmp/sha256.scm > > ;;; (hash "b33576331465a60b003573541bf3b1c205936a16c407bc69f8419a527bf5c9= 88") > clock utime stime cutime cstime gctime > 59.31 80.65 0.39 0.00 0.00 30.73 > > It=E2=80=99s a disappointingly small improvement. The reason is that (ha= shing > fixnums) adds another layer of opacity, where it ends up doing > essentially: > > (define fx32xor fxxor) > =E2=80=A6 > > Thus, no inlining, and no easy trick to solve that. :-/ I've pushed a Guile-specific version of (hashing fixnums) that inlines the generic arithmetic procedures. This and some other small changes improved the runtime: clock utime stime cutime cstime gctime before: 2.2.6 31.06 32.61 0.03 0.00 0.00 1.38 2.9.8 15.55 16.23 0.01 0.00 0.00 1.19 after: 2.2.6 2.95 3.01 0.00 0.00 0.00 0.10 2.9.8 1.98 1.99 0.00 0.00 0.00 0.08 That's about 100 times slower than sha256sum from coreutils. You might get some more performance out of it by unrolling the loop in sha-256-transform!. Regards, --=20 G=C3=B6ran Weinholt | https://weinholt.se/ Debian developer | 73 de SA6CJK