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?Ludovic_Court=C3=A8s?= Newsgroups: gmane.lisp.guile.devel Subject: Re: SHA256 performance with Guile 2.2 vs. Guile 3.0 Date: Mon, 06 Jan 2020 10:47:07 +0100 Message-ID: <875zhoex2c.fsf@gnu.org> References: <874kxcnlh8.fsf@inria.fr> <87sgkwm4uv.fsf@gnu.org> <871rse1bes.fsf@pobox.com> 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="43724"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) Cc: Guile Devel To: Andy Wingo Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Mon Jan 06 10:47:24 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 1ioOyp-000BEm-RB for guile-devel@m.gmane.org; Mon, 06 Jan 2020 10:47:23 +0100 Original-Received: from localhost ([::1]:49932 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ioOyo-0002w2-I4 for guile-devel@m.gmane.org; Mon, 06 Jan 2020 04:47:22 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:57770) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ioOyd-0002tZ-Qs for guile-devel@gnu.org; Mon, 06 Jan 2020 04:47:13 -0500 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:51736) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ioOyc-0005nr-C7; Mon, 06 Jan 2020 04:47:10 -0500 Original-Received: from [2001:660:6102:320:e120:2c8f:8909:cdfe] (port=57566 helo=ribbon) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1ioOyb-0001vR-RC; Mon, 06 Jan 2020 04:47:10 -0500 X-URL: http://www.fdn.fr/~lcourtes/ X-Revolutionary-Date: 17 =?utf-8?Q?Niv=C3=B4se?= an 228 de la =?utf-8?Q?R?= =?utf-8?Q?=C3=A9volution?= X-PGP-Key-ID: 0x090B11993D9AEBB5 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-pc-linux-gnu In-Reply-To: <871rse1bes.fsf@pobox.com> (Andy Wingo's message of "Sun, 05 Jan 2020 10:48:43 +0100") X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] 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:20231 Archived-At: Hello, Andy Wingo skribis: > On Sat 04 Jan 2020 01:40, 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 "b33576331465a60b003573541bf3b1c205936a16c407bc69f8419a527bf5= c988") >>> clock utime stime cutime cstime gctime >>> 65.17 89.75 0.45 0.00 0.00 35.63 >> >> (define fx32xor fxxor) >> =E2=80=A6 > > From a speed perspective I think there is one major issue and one minor > issue. > > The major issue is that we don't do cross-module inlining. But now that > we have declarative modules, this is a possibility: > > https://lists.gnu.org/archive/html/guile-devel/2016-03/msg00026.html > https://lists.gnu.org/archive/html/guile-devel/2016-03/msg00027.html Neat. Storing Tree-IL in object files reminds me of LTO in GCC & co. > With cross-module inlining of "small" definitions, I think we would > solve a lot of this kind of problem. I think we could add this during > 3.0 and for this reason I would hesitate to apply this patch for 3.0 > because it changes "fx+" exports to be macros rather than "normal" > values in the ABI. WDYT? I agree that cross-module inlining is the better fix whereas this patch is the immediate workaround. Are you confident that cross-module inlining can happen be added without introducing incompatibilities over in the 3.0 series? (At first sight it seems tricky to me, notably because we=E2=80=99d have to store Tree-IL in object files, which introduces compatibility and thus external representation versioning considerations.) If you do, then it=E2=80=99s fine to drop this patch. If conversely cross-module inlining might take longer, then we can have this patch in and drop it in 3.2. Your call! (I guess I=E2=80=99m not being that helpful here. :-)) > The minor issue, at least relatively speaking, is that IMO the (rnrs > arithmetic fixnums) API is not appropriate for bitwise operations. When > you do bitwise operations and you want to ensure that you're within some > fixed domain, it's best to do e.g. "(logand x #xffffffff)" on operands > and results. Guile will optimize this well. The good optimization > isn't fixnum vs other kinds of numbers, it's unboxing to raw unsigned > integers; and you usually want to exclude negative numbers. fx+ doesn't > help with that. I agree, of course. The tragedy is that people would use this (clumsy) API in the hope of getting better performance, and the result ends up being worse performance, at least on today=E2=80=99s Guile (perhaps also on other implementations?). Thanks, Ludo=E2=80=99.