From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Andy Wingo Newsgroups: gmane.lisp.guile.devel Subject: Re: SHA256 performance with Guile 2.2 vs. Guile 3.0 Date: Sun, 05 Jan 2020 10:48:43 +0100 Message-ID: <871rse1bes.fsf@pobox.com> 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="262721"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) Cc: Guile Devel To: Ludovic =?utf-8?Q?Court=C3=A8s?= Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Sun Jan 05 10:49:08 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 1io2Wx-0016Ax-3Z for guile-devel@m.gmane.org; Sun, 05 Jan 2020 10:49:07 +0100 Original-Received: from localhost ([::1]:40418 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1io2Wv-0007ao-VA for guile-devel@m.gmane.org; Sun, 05 Jan 2020 04:49:05 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:37121) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1io2Wr-0007ZP-27 for guile-devel@gnu.org; Sun, 05 Jan 2020 04:49:02 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1io2Wn-0006j0-H9 for guile-devel@gnu.org; Sun, 05 Jan 2020 04:49:00 -0500 Original-Received: from fanzine.igalia.com ([178.60.130.6]:39343) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1io2Wm-0006d9-T6; Sun, 05 Jan 2020 04:48:57 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=igalia.com; s=20170329; h=Content-Transfer-Encoding:Content-Type:MIME-Version:Message-ID:In-Reply-To:Date:References:Subject:Cc:To:From; bh=Adux83WJWeCaevlClUJ3UfDK16of2oJOZ48NIADdkoY=; b=iYScNr/XhbLRZZ8iocseBB3MGIELONMeAhq+FjKcr3SGOsyUg5nVhnldo1DzbWoafY66SCanZvGXzqWz4uu/tMdZ7B4LEySSIsQ5UVjUzVJahTy5ubGkh/4yAF6HpjXue4mRbzinM5xf5+ybcPrHKNCi9KnVxBQQbLQJd7NxrhGOFYFOLxKCqosYvFegZ5YszUFJByOJxu3npnh5jRempLyUrz/ccBOwfEMBh5OuGOrN7PGwBMs5diH37aucukCd02+BzkxfQ+im121wD9TnFRnGOjKpLK5A0c4MH3Wrq0ePh4rQkQP5HECq02u4jq9a1a3LFUgeL5IONZYEXP0pQg==; Original-Received: from [88.123.12.110] (helo=sparrow) by fanzine.igalia.com with esmtpsa (Cipher TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim) id 1io2Wk-0002lt-6M; Sun, 05 Jan 2020 10:48:54 +0100 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: GNU/Linux 2.2.x-3.x (no timestamps) [generic] [fuzzy] X-Received-From: 178.60.130.6 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:20215 Archived-At: 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 "b33576331465a60b003573541bf3b1c205936a16c407bc69f8419a527bf5c= 988") >> 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 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? 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. Cheers, Andy